Advertisement
Bits4Bots

Arduino Hello Message-Alphanumeric 16 Segment Display

Dec 29th, 2015
1,605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.36 KB | None | 0 0
  1. Arduino Code
  2. Alphanumeric Display
  3. 'Displays Hello'
  4. Code Starts Here:
  5.  
  6. //Arduino Alphabet with Alphanumeric Display, Common Cathode
  7. //By L. Johnson www.bits4bots.com
  8. //12/29/15
  9. void setup() {              
  10.   pinMode(2, OUTPUT);  //set pins 2-11 to output
  11.   pinMode(3, OUTPUT);
  12.   pinMode(4, OUTPUT);
  13.   pinMode(5, OUTPUT);
  14.   pinMode(6, OUTPUT);
  15.   pinMode(7, OUTPUT);
  16.   pinMode(8, OUTPUT);
  17.   pinMode(9, OUTPUT);
  18.   pinMode(10, OUTPUT);  
  19.   pinMode(11, OUTPUT);
  20.  }
  21. void loop() {
  22.   // write 'H'
  23.  digitalWrite(2, 0); //writes low to pin 2
  24.  digitalWrite(3, 0); //same for pins 3-7
  25.  digitalWrite(4, 0);
  26.  digitalWrite(5, 0);
  27.  digitalWrite(6, 0);
  28.  digitalWrite(7, 0);
  29.  digitalWrite(8, 1); //writes high to pin 8
  30.  digitalWrite(9, 1); //same for 9-11
  31.  digitalWrite(10, 1);
  32.  digitalWrite(11, 1);
  33.   delay(1000); //pause 1 sec before displaying the next character
  34.    
  35.    //write 'e'
  36.  digitalWrite(2, 1);
  37.  digitalWrite(3, 0);
  38.  digitalWrite(4, 0);
  39.  digitalWrite(5, 1);
  40.  digitalWrite(6, 1);
  41.  digitalWrite(7, 1);
  42.  digitalWrite(8, 0);
  43.  digitalWrite(9, 1);
  44.  digitalWrite(10, 1);
  45.  digitalWrite(11, 0);
  46.   delay(1000);
  47.    
  48.    //write 'l'
  49.  digitalWrite(2, 1);
  50.  digitalWrite(3, 1);
  51.  digitalWrite(4, 1);
  52.  digitalWrite(5, 1);
  53.  digitalWrite(6, 1);
  54.  digitalWrite(7, 1);
  55.  digitalWrite(8, 1);
  56.  digitalWrite(9, 0);
  57.  digitalWrite(10, 0);
  58.  digitalWrite(11, 1);
  59.   delay(1000);
  60.  
  61.      //write 'blank off-for visual purpose'
  62.  digitalWrite(2, 1);
  63.  digitalWrite(3, 1);
  64.  digitalWrite(4, 1);
  65.  digitalWrite(5, 1);
  66.  digitalWrite(6, 1);
  67.  digitalWrite(7, 1);
  68.  digitalWrite(8, 1);
  69.  digitalWrite(9, 1);
  70.  digitalWrite(10, 1);
  71.  digitalWrite(11, 1);
  72.   delay(100);
  73.  
  74.      //write 'l'
  75.  digitalWrite(2, 1);
  76.  digitalWrite(3, 1);
  77.  digitalWrite(4, 1);
  78.  digitalWrite(5, 1);
  79.  digitalWrite(6, 1);
  80.  digitalWrite(7, 1);
  81.  digitalWrite(8, 1);
  82.  digitalWrite(9, 0);
  83.  digitalWrite(10, 0);
  84.  digitalWrite(11, 1);
  85.   delay(1000);
  86.  
  87.      //write 'o'
  88.  digitalWrite(2, 1);
  89.  digitalWrite(3, 0);
  90.  digitalWrite(4, 0);
  91.  digitalWrite(5, 1);
  92.  digitalWrite(6, 1);
  93.  digitalWrite(7, 1);
  94.  digitalWrite(8, 1);
  95.  digitalWrite(9, 1);
  96.  digitalWrite(10, 0);
  97.  digitalWrite(11, 0);
  98.   delay(1000);
  99.  
  100.     delay(4000); //loop
  101. }  //end of message program will now loop from the beginning
  102.  
  103. Please visit www.bits4bots.com/blog for more projects. Also see the project live on YouTube. Channel Bits4Bots!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement