EmperorPhoenix

Messager

Mar 9th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.39 KB | None | 0 0
  1. /*
  2.   The circuit:
  3.  * LCD RS pin to digital pin 12
  4.  * LCD Enable pin to digital pin 11
  5.  * LCD D4 pin to digital pin 5
  6.  * LCD D5 pin to digital pin 4
  7.  * LCD D6 pin to digital pin 3
  8.  * LCD D7 pin to digital pin 2
  9.  * LCD R/W pin to ground
  10.  * LCD VSS pin to ground
  11.  * LCD VCC pin to 5V
  12.  * 10K resistor:
  13.  * ends to +5V and ground
  14.  * wiper to LCD VO pin (pin 3)
  15.  
  16.  http://www.arduino.cc/en/Tutorial/LiquidCrystal
  17.  */
  18.  
  19. // include the library code:
  20. #include <LiquidCrystal.h>
  21.  
  22. // initialize the library with the numbers of the interface pins
  23. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  24.  
  25. void setup() {
  26.   // set up the LCD's number of columns and rows:
  27.   lcd.begin(16, 2);
  28.   // Print a message to the LCD.
  29.   Serial.begin(9600);
  30.   pinMode(8, INPUT);
  31.   pinMode(9, INPUT);
  32.  
  33. }
  34.  
  35. char* mes;
  36. char* newmes;
  37.  
  38. void loop() {
  39.   lcd.clear();
  40.   // set the cursor to column 0, line 1
  41.   // (note: line 1 is the second row, since counting begins with 0):
  42.   lcd.setCursor(0, 1);
  43.   float ono = analogRead(5);
  44.   // print the number of seconds since reset:
  45.   lcd.print(mes);
  46.   int non = map(ono, 0, 1023, 90, 65);
  47.   lcd.setCursor(0,0);
  48.   char nunu=(char)non;
  49.   lcd.print(nunu);
  50.   //lcd.print(nunu);
  51.   delay(200);
  52.   if(digitalRead(8)==HIGH){
  53.     newmes = new char[sizeof(mes)+1];
  54.     for(int i=0; i<sizeof(mes); i++){
  55.       newmes[i]=mes[i];
  56.     }
  57.     newmes[sizeof(newmes)]=nunu;
  58.     mes=newmes;
  59.   }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment