I got my first Audurino-UNO last year from the local Audurino pusher www.let-elektronik.dk. I got the device and made a simple program, the problem was that after programming the board - everything was looking fine the program was working as it should, reading the analog port and writing the data to the serial port, but I was not able to connect to the board again using the programming software. In the last part of the code I was using a 'delay(200)' command and that seams to be the problem after changing the delay to 3000, everything was working OK.
// Take input from potmeter and write to rs232
// Potmeter center pin to A0 analog port
// Potmeter outer pin to 5 volt and 9 volt
//
// Geek november 2010
#define SENSOR 0
int val = 0;
void setup()
{
Serial.begin(9600); //open RS232 port speed 9600
}
void loop()
{
val = analogRead(SENSOR); // make analog read and store result in val
Serial.println("Raw from sensor"); // send text sting to serial
Serial.println(val); // send val to serial
delay(3000); // wait 3000 mS
}

Ingen kommentarer:
Send en kommentar