Hardware serial port

"0\n" results in the values 48 and 10 being sent.

doesn't look like you're filtering the slider values from being the LED on/off values. can you separately read the thumbPosition and only if it is not either of the led on/off values send it

is the code constantly sending an LED on/off code, regardless if the button is pressed or released? does the code need to constantly check the button state for a state change and then only send a value?

Now I sent it as ONE byte number but same thing Tx LED stays ON and then off but my LED connected is OFF not turning ON.

what prevents the slide/triac code from sending 181 or 182?

what values is the arduino code chacking for?

For now control is here:

void loop () {
  if (Serial.available()) {
    char rec = Serial.read ();

    switch (rec)  {
      case '\n':
        break;

      case 181:  // OR ANY VALUE SENT BY THE APP!!!
        digitalWrite (PinLed, LedOff);
        break;

      case 182:  // OR ANY VALUE SENT BY THE APP!!!
        digitalWrite (PinLed, LedOn);
        break;

      default:
        myvalue = map (rec, 0, 180, 6700, 10);  // OR ANY VALUE SENT BY THE APP!!!
        Serial.print   ("  myvalue ");
        Serial.println (myvalue);
        break;
    }
  }

This should now work. Does it ?

change to

    if (Serial.available()) {
        char rec = Serial.read ();

        Serial.print ("  rec ");
        Serial.println (rec, DEC);
1 Like

i do not know what arduino check either it could be ASCII or a number or sting or text or character or some logic (True or False) etc

Sorry but what are the "BluetoothClient1.SendText" after the "Send1ByteNumber" in your block ? Doubt you need it...

I have blocked send.Text command

why not just see what exactly the arduino is receiving. it can't received a logic true false, simply a byte value with 8bits.

I used this approach , arduino receives commands as indicated by Tx LED status but my External LED stays off no impact of commands being received . My Serial monitor is also down because my comport is Disabled there is some issue with my comport too. So folks lets see tomorrow as its late Night now.

please post the output from the arduino serial monitor.

presuambly by "Tx LED" you mean the LED on the RX pin indicating changing values on the RX input.

don't understand what you mean by "comport is Disabled".

No only Tx glows on sending commands. and this is the serial monitor output upon sending 181 and 182: This is how it receives 181 and 182 how would LED turn on/off then.

Note: Slider operation is successful and as expected only problem remained is that the slider interferes with the functionality of Led Button in the app.

This indicates that your APP is not sending a byte but a text: 49 is the ASCII value of '1', 56 the one of '8' and 50 is '2'. So you're sending '1', '8', '1' (= "181") and '1', '8', '2' (= "182")
Modify you APP to send one byte (181 or 182), not text.

It shouldn't if it sends value within [0-180] but the LED buttons will interfere with power level if they send ASCII chars (all ASCII digits from '0' to '9' have a value between 0 and 180 as you can see in the table post #12)

adding debugging like this exposes problems without having to guess

YES, I converted my command to send one byte number but it works up to 127. I sent 127 and 128 this was the serial monitor output.

When I sent 181 and 182 This was serial monitor output:


I can not use values between 2 - 180 as they serve for my triac output.