Last active
          August 26, 2019 13:32 
        
      - 
      
- 
        Save villares/afc2cdd696449017628b85e9264d5e81 to your computer and use it in GitHub Desktop. 
    Garoa Dojo com Arduino
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| Analog Input | |
| Demonstrates analog input by reading an analog sensor on analog pin 0 and | |
| turning on and off a light emitting diode(LED) connected to digital pin 13. | |
| The amount of time the LED will be on and off depends on the value obtained | |
| by analogRead(). | |
| */ | |
| int sensorPin = A0; // select the input pin for the potentiometer | |
| int ledPin = 13; // select the pin for the LED | |
| int sensorValue = 0; // variable to store the value coming from the sensor | |
| void setup() { | |
| // declare the ledPin as an OUTPUT: | |
| pinMode(ledPin, OUTPUT); | |
| } | |
| void loop() { | |
| // read the value from the sensor: | |
| sensorValue = analogRead(sensorPin); | |
| // turn the ledPin on | |
| digitalWrite(ledPin, HIGH); | |
| // stop the program for <sensorValue> milliseconds: | |
| delay(sensorValue); | |
| // turn the ledPin off: | |
| digitalWrite(ledPin, LOW); | |
| // stop the program for for <sensorValue> milliseconds: | |
| delay(sensorValue); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| Blink | |
| Turns an LED on for one second, then off for one second, repeatedly. | |
| */ | |
| int ledPin = 13; | |
| // the setup function runs once when you press reset or power the board | |
| void setup() { | |
| // initialize digital pin LED_BUILTIN as an output. | |
| pinMode(ledPin, OUTPUT); | |
| } | |
| // the loop function runs over and over again forever | |
| void loop() { | |
| digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) | |
| delay(1000); // wait for a second | |
| digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW | |
| delay(1000); // wait for a second | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment