Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- SoftwareSerial mySerial = SoftwareSerial(255, 6);
- int potentiometerValue01 = 0;
- int potentiometerValue02;
- int potentiometerValue03;
- int potentiometerValue04;
- int potentiometerValue05;
- int potentiometerValue06;
- int lifeExpectancy;
- void setup() {
- pinMode(6, OUTPUT);
- digitalWrite(6, HIGH);
- Serial.begin(9600);
- mySerial.begin(9600);
- mySerial.write(17); // Turn backlight on
- }
- void loop() {
- // read the potentiometers
- potentiometerValue01 = analogRead(0);
- //Serial.println("potentiometerValue01 = "+potentiometerValue01);
- delay(100);
- potentiometerValue02 = analogRead(1);
- //Serial.println("potentiometerValue02 = "+potentiometerValue02);
- delay(100);
- potentiometerValue03 = analogRead(2);
- //Serial.println("potentiometerValue03 = "+potentiometerValue03);
- delay(100);
- potentiometerValue04 = analogRead(3);
- //Serial.println("potentiometerValue04 = "+potentiometerValue04);
- delay(100);
- potentiometerValue05 = analogRead(4);
- Serial.println("potentiometerValue05 = "+potentiometerValue05);
- delay(100);
- potentiometerValue06 = analogRead(5);
- //Serial.println("01 02 03 04 05 06 = "+potentiometerValue01+" "+potentiometerValue02+" "+potentiometerValue03+" "+potentiometerValue04+" "+potentiometerValue05+" "+potentiometerValue06);
- lifeExpectancy = (potentiometerValue01 + potentiometerValue02 + potentiometerValue03 + potentiometerValue04 + potentiometerValue05 + potentiometerValue06)/24;
- // mySerial.write(212); // Quarter note
- // mySerial.write(220); // A tone
- // write the message
- delay(100);
- mySerial.write(12); // Clear
- //mySerial.write(17); // Turn backlight on
- delay(5); // Required delay
- mySerial.print("Life:"); // First line
- mySerial.write(13); // Form feed
- mySerial.print(lifeExpectancy); // Second line
- delay(500); // Wait 3 seconds
- //mySerial.write(18); // Turn backlight off
- }
Advertisement
Add Comment
Please, Sign In to add comment