Skip navigation

Arduino

2 Posts authored by: beaupalmer

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:
  }

Hello, my name is Beau Palmer. Married with 2 adult children and 3 wonderful grandchildren. Retired telecommunications engineer. Interested in nearly ALL things electronic, electrical and electromechanical. I'll end here. If anyone receives this transmission please respond, I have had NO success up to now !!!

Filter Blog

By date: By tag: