variables at the beginning of my programs for setting information


i trying use variables @ beginning of programs setting information can viewed serial monitor. able enter information , have show when sketch first runs.  having problems doing this. program name not show up. float correct way enter program version number. able enter version number 1.0.1  getting many decimals points in number fault. have suggestions.

sketch:

char programname = "blinker";   
float versionnumber = 1.0;

int timeon(500);    // milliseconds
int timeoff(1500);  // milliseconds

void setup() {
  serial.begin(9600);      // turn on serial port

  serial.print("program: ");
  serial.println(programname);
  serial.print("version: ");
  serial.println(versionnumber);
 
  pinmode(13, output);

}
void loop() {
 
 // blink code   
  digitalwrite(13, high);   
  delay(timeon);             
  digitalwrite(13, low);   
  delay(timeoff);     
}

a char uses 1 byte. don't think can put "blinker" in char.  maybe put in character array , print iterating on index?

code: [select]
char programname [] = "blinker";
 
jimmy


Arduino Forum > Using Arduino > Programming Questions > variables at the beginning of my programs for setting information


arduino

Comments

Popular posts from this blog

Valutazione Template - Joomla! Forum - community, help and support

SD Datastring Convention

First use of Arduino Uno : avrdude error on Blink uploading