Browse Source

upd

master
Your Name 4 years ago
parent
commit
c01be9e355
1 changed files with 58 additions and 0 deletions
  1. +58
    -0
      PHSensor/code/BasicPHSensor/BasicPHSensor.ino

+ 58
- 0
PHSensor/code/BasicPHSensor/BasicPHSensor.ino View File

@ -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);
}

Loading…
Cancel
Save