I want it to print "On", but that doesn't seem to happen. With troubleshooting I figured out that InternalTemperatureSwitch is not being transferred correctly.
Serial.println(InternalTemperatureSwitch) says "n" at 38400 baud
Serial.println(buffer) says ""
So the conversion from one array to another isn't working for some reason. Any ideas?
char InternaltemperatureSwitch[4]; // I assume you want "Off" too, so you'll need 4 elements, not 3, for "Off\0"
strcpy(InternaltemperatureSwitch, "On");
char InternaltemperatureSwitch[4]; // I assume you want "Off" too, so you'll need 4 elements, not 3, for "Off\0"
strcpy(InternaltemperatureSwitch, "On");
I used strcpy and the Serial Monitor showed "On" for the print of InternaltemperatureSwitch, and for the buffer ""
Although the values on my website won't change for some reason. It will work for numbers, but not letters for some reason. Why would this happen?
char InternaltemperatureSwitch[4]; // I assume you want "Off" too, so you'll need 4 elements, not 3, for "Off\0"
strcpy(InternaltemperatureSwitch, "On");
I used strcpy and the Serial Monitor showed "On" for the print of InternaltemperatureSwitch, and for the buffer ""
Although the values on my website won't change for some reason. It will work for numbers, but not letters for some reason. Why would this happen?
Because you don't have any quotes around the string in your JavaScript assignment...?
char InternalTemperature[4]; //Array for storage
...
strcpy(InternalTemperature, "On"); //Copy Switch Value
Serial.println(InternalTemperature); //Troubleshooting InternalTemperature in Serial Monitor
char CITbuffer[128]; //Buffer for client
sprintf(CITbuffer,"<script>document.getElementById(\"Current_Internal_Temp\").innerHTML=%s;</script>","InternalTemperature");
//Conversion from array to client.
Serial.println(CITbuffer);//Troubleshooting CITbuffer in Serial Monitor
client.println(CITbuffer);
This is the exact code I have, and it still seems to not be printing letters. If I change the %s to a %d I can get it to work for numbers. For some reason it doesn't like %s.
Yes! That is what I want. Although, for some reason it doesn't change the html to the state of the switch. It just stays as "Loading" when a client connects.
I have no clue what the issue is....because the java only changes the html if it is a number and not a letter (or letters).
I am using %s for my pH probe and it works just fine. The "Loading" changes to 3.5, but if I use %s for letters it never changes the html.
IDE Code:
void setup() {
Serial.begin(9600);
char InternalTemperature[4]; //Array for storage
strcpy(InternalTemperature, "On"); //Copy Switch Value
Serial.println(InternalTemperature); //Troubleshooting InternalTemperature in Serial Monitor
char CITbuffer[128]; //Buffer for client
sprintf(CITbuffer,"<script>document.getElementById(\"Current_Internal_Temp\").innerHTML=%s;</script>",InternalTemperature);
Serial.println(CITbuffer);//Troubleshooting CITbuffer in Serial Monitor
}
void loop() {
}