Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:arduino:examples [2017/08/09 07:24] kaupo.raiden:arduino:examples [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 162: Line 162:
 { {
   // Get digital value of potentiometer   // Get digital value of potentiometer
-  poteOlek = digitalRead(pot);+  potState = digitalRead(pot);
      
   // When potentiometer digital value is logical "true" then turn on LED   // When potentiometer digital value is logical "true" then turn on LED
Line 199: Line 199:
 { {
   // Get analog value of potentiometer   // Get analog value of potentiometer
-  poteOlek = analogRead(pot); +  potState = analogRead(pot); 
      
   // Turn LED on   // Turn LED on
Line 211: Line 211:
      
   // Halt the program for potentiometer analog value number of milliseconds   // Halt the program for potentiometer analog value number of milliseconds
-  delay(poteOlek); +  delay(potState); 
 } }
 </code> </code>
Line 238: Line 238:
      
   // When potentiometer value is greater than 0 then set LED on halt program for short period   // When potentiometer value is greater than 0 then set LED on halt program for short period
-  if (poteOlek > 0) +  if (potState > 0) 
   {   {
     digitalWrite(led, HIGH);     digitalWrite(led, HIGH);
-    delayMicroseconds(poteOlek); +    delayMicroseconds(potState); 
   }   }
      
Line 248: Line 248:
      
   // Halt program for short period   // Halt program for short period
-  delayMicroseconds(1023 - poteOlek); +  delayMicroseconds(1023 - potState); 
 } }
 </code> </code>
Line 457: Line 457:
    
   // Print out explaining text   // Print out explaining text
-  lcd.print("Kaugus:");+  lcd.print("Dist:");
   lcd.setCursor(0, 1);   lcd.setCursor(0, 1);
-  lcd.print("Naeb:");+  lcd.print("Object:");
 } }
 void loop()  void loop() 
Line 482: Line 482:
    
   // when infrared sensor does not see anything print out "no", otherwise print out "yes".   // when infrared sensor does not see anything print out "no", otherwise print out "yes".
-  if(infrapunaNaebObjekti == 1) lcd.print("no "); +  if(proximity == 1) lcd.print("no "); 
   else lcd.print("yes");    else lcd.print("yes"); 
    
en/arduino/examples.1502263458.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0