Advertisement
Guest User

C-Innova Arduino LED Workshop: Code 1

a guest
Jan 19th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.46 KB | None | 0 0
  1. /*
  2.  * LIGHTS, SOUND, ACTION!
  3.  * ARDUINO AND ELECTRONICS WORKSHOP
  4.  *
  5.  * JANUARY 19, 2017: 3:30 - 6:00 PM
  6.  * INSTRUCTOR: JUSTIN GONG
  7.  * C-INNOVA, BOGOTA, COLOMBIA
  8.  */
  9.  
  10.  
  11. // ************************************************************************************
  12. // *******************************   INITIALIZATION   *********************************
  13. // ************************************************************************************
  14.  
  15. int ledPin = 11;                      // sets which pin connects to LED Strip +5V
  16. int micInput = A0;
  17.  
  18. // ************************************************************************************
  19. // *******************************   SETUP, RUNS ONCE   *******************************
  20. // ************************************************************************************
  21.  
  22.  
  23. void setup()
  24. {
  25.    Serial.begin(9600);                // sets the data rate at which the Arduino runs in bits per second
  26.    pinMode(ledPin, OUTPUT);           // configures pin to behave as either input or output
  27. }
  28.  
  29.  
  30. // ************************************************************************************
  31. // **************************   LOOP, RUNS CONTINUOUSLY   *****************************
  32. // ************************************************************************************
  33.  
  34. void loop()
  35. {
  36.  
  37.    int voltsraw = analogRead(micInput);
  38.    Serial.print("microphone voltage: ");
  39.    Serial.println(voltsraw);
  40.    
  41.    digitalWrite(ledPin, HIGH);
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement