How to send 1 or 0 FROM Arduino TO SmartThings

Hello,
I’m an experienced Arduino user, but new to using the SmartThings Arduino shield. I’ve read through the unofficial documentation started by jordanrejaud. I have some more questions.

I have an Arduino that uses several types of sensors to determine a state (1 or 0). I want that state to be reflected on the SmartThings app. The closest example I could find is the “buttonhello.ino” example. But that example assumes the button is a momentary button. In my analogy, I want the button to be a on/off button that sends the specific state to SmartThings, not just the button push event.

The buttonhello.ino is sending this:
smartthing.send(“buttonpush”);

Is that how SmartThings handles all incoming data? It parsces the string that is sent to determine the activity? In which case I could do a smartthing.send(“button_on”) and a separate smartthing.send(“button_off”), and then have the “groovy” file differentiate between those two strings and light up the tiles differently?

If that works on the Arduino side, then my next question is on the SmartThings side. I’ve only been able to find a on-off-shield-example.groovy. I haven’t been able to find the associated groovy code for the “buttonhello.ino”. Is it as simple as locating the buttonhello.ino’s associated groovy code and modifying it to manipulate the tiles for on/off indication?

Thanks!
Duino

just about anything can be in the smartthing.send(“buttonpush”). It gets sent out as ASCII then parsed back in the Device Type.

You can see it happen in the on-off-shield-example.groovy file in the parse section.