Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The circuit:
- * LCD RS pin to digital pin 12
- * LCD Enable pin to digital pin 11
- * LCD D4 pin to digital pin 5
- * LCD D5 pin to digital pin 4
- * LCD D6 pin to digital pin 3
- * LCD D7 pin to digital pin 2
- * LCD R/W pin to ground
- * LCD VSS pin to ground
- * LCD VCC pin to 5V
- * 10K resistor:
- * ends to +5V and ground
- * wiper to LCD VO pin (pin 3)
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
- */
- // include the library code:
- #include <LiquidCrystal.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
- void setup() {
- // set up the LCD's number of columns and rows:
- lcd.begin(16, 2);
- // Print a message to the LCD.
- Serial.begin(9600);
- pinMode(8, INPUT);
- pinMode(9, INPUT);
- }
- char* mes;
- char* newmes;
- void loop() {
- lcd.clear();
- // set the cursor to column 0, line 1
- // (note: line 1 is the second row, since counting begins with 0):
- lcd.setCursor(0, 1);
- float ono = analogRead(5);
- // print the number of seconds since reset:
- lcd.print(mes);
- int non = map(ono, 0, 1023, 90, 65);
- lcd.setCursor(0,0);
- char nunu=(char)non;
- lcd.print(nunu);
- //lcd.print(nunu);
- delay(200);
- if(digitalRead(8)==HIGH){
- newmes = new char[sizeof(mes)+1];
- for(int i=0; i<sizeof(mes); i++){
- newmes[i]=mes[i];
- }
- newmes[sizeof(newmes)]=nunu;
- mes=newmes;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment