Hey guys,
so I wrote this Programm, which is supposed to show me values of two different sensors. For some reason the serial monitor only prints ASCII symbols but I need Numbers...
Does anybody have an idea how to convert the symbols to numbers?
This is my code by the way:
#include "rgb_lcd.h"
#include <Wire.h>
rgb_lcd lcd;
const int numRows=2;
const int numCols=16;
int count=0;
const int maximum=100;
const int button=A2;
const int moisture=A0;
const int light=A1;
void setup() {
// put your setup code here, to run once:
pinMode(moisture, INPUT);
pinMode(light, INPUT);
pinMode(button, INPUT);
lcd.begin(numCols, numRows);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int moistureState=analogRead(moisture);
int lightState=analogRead(light);
int buttn=digitalRead(button);
if(buttn==1) {
count=count+1;
}
if(count%2) {
lcd.setCursor(0,0);
lcd.write("Moisture: ");
delay(200);
lcd.write(moistureState);
//Serial.write("Moisture: ");
delay(200);
//Serial.write(moistureState);
lcd.setCursor(0,1);
lcd.write("Count: ");
delay(200);
lcd.write(count);
Serial.write("Button: ");
Serial.write(count);
Serial.write("\n");
}
else {
lcd.clear();
lcd.setCursor(0,0);
lcd.write("Light: ");
delay(200);
lcd.write(lightState);
//Serial.write("Light: ");
delay(200);
//Serial.write(lightState);
Serial.write("Button: ");
Serial.write(count);
Serial.write("\n");
}
}
Thanks in advance!