AWOL:
Program structure is easier to follow if you indent it like thisvoid loop()
{
if(Serial.available()){
ch=Serial.read();
}
orvoid loop()
{
if(Serial.available())
{
ch=Serial.read();
}The compiler doesn't care, but my first reading of your revised code was that nothing had changed.
Looking at my first post you can observe what I wrote is:
void loop(){
if(Serial.available()){
delay(100);
char ch=Serial.read();
switch(ch)
{
case '1':
SHT1();
break;
.......
}
Now I've changed the code:
char ch=0;
void setup(){
....}
void loop(){
if(Serial.available()){
ch=Serial.read();
}
switch(ch)
{
case '1':
SHT1();
break;
......
}
}
This is pretty different! Anyway my own Arduino now works exactly as I wish!!