From c01be9e35540e5793d86a84a3f8f341deee9191a Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 12 May 2020 22:04:16 -0400 Subject: [PATCH] upd --- PHSensor/code/BasicPHSensor/BasicPHSensor.ino | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 PHSensor/code/BasicPHSensor/BasicPHSensor.ino diff --git a/PHSensor/code/BasicPHSensor/BasicPHSensor.ino b/PHSensor/code/BasicPHSensor/BasicPHSensor.ino new file mode 100644 index 0000000..0623854 --- /dev/null +++ b/PHSensor/code/BasicPHSensor/BasicPHSensor.ino @@ -0,0 +1,58 @@ +#include "Nokia_5110.h" + +//https://github.com/baghayi/Nokia_5110 +//MIT license + +//These have been slightly edited from default (normal is 2,3,4,5,6) + +#define RST 3 +#define CE 4 +#define DC 5 +#define DIN 6 +#define CLK 7 + +Nokia_5110 lcd = Nokia_5110(RST, CE, DC, DIN, CLK); + +#define PHSENSOR A3 + +//uno is 10 bit adc +uint16_t phVal_u16 = 0; +float phFloat = 0; + +void setup() { + + Serial.begin(9600); + /** + * Note: if instead of text being shown on the display, all the segments are on, you may need to decrease contrast value. + */ + lcd.setContrast(28); // 60 is the default value set by the driver + + //lcd.print("Please Wait ..."); + lcd.setCursor(15,1); + lcd.print("Starting..."); + delay(800); + lcd.clear(); + + //lcd.print("Hi there"); + //lcd.println(":D"); + + //lcd.setCursor(0, 5); + //lcd.println("1 2 3 ..."); +} + +void loop() { + lcd.clear(); + phVal_u16 = analogRead(PHSENSOR); + phFloat = phVal_u16 * 0.013672; + lcd.setCursor(15,1); + lcd.println("Raw:"); + lcd.setCursor(45,2); + lcd.print(phVal_u16); + lcd.setCursor(15,3); + lcd.println("PH #:"); + lcd.setCursor(45,4); + lcd.print(phFloat); + //Serial.println(phVal_u16); + delay(1000); + + }