Attached is my first attempt at C language programming for my new Arduino UNO R3.
I am unable to understand the VERIFIER's error messages. Any help would be really appreciated
Beau
New Member
Robot ver. 1.0
int Duration=0; // Define a timed variable called Duration and initialize to 0.0 us:
void Setup() {
pinMode(0,INPUT); // Set Pin D0 as an Input:
pinMode(1,OUTPUT); // Set Pin D1 as an Output:
pinMode(2,OUTPUT); // Set Pin D2 as an Output:
}
void loop() {
Pulsein(0,HIGH); // Read Positive going Pulse Width Input at D0:
Duration=Pulsein; // Store Pulse Width, in us., in Duration:
if(Duration<1250); DigitalWrite(1,LOW); // If Duration less than 1250 us Set D1 Low:
if(Duration>1750); DigitalWrite(2,LOW); // If Duration greater than 1750 us Set D2 Low:
if(Duration>=1250); AND if(Duration<=1750); DigitalWrite(1,HIGH);DigitalWrite(2,HIGH); // If Duration between 1250 us and 1750 us Set both D1 and D2 High:
}