sure bud no problem! Make no mistake all these photon smartthings projects are also my first attempt at coding too. I’m not a programmer but pilot by trade so I’m probably horrible about explaining what I have done. I can post my whole thing if you want but there is alot of extra crap in there it might be easy to lose what I have done for the part your interested in especially since I havent commented it the best. So with that in mind instead I will post a small example program that would do nothing but what you have asked for.
int microswitch = D0; // define a pin for the microswitch
String garageContact = "unknown"; // on startup set the garageContact status to unknown and define the vaiable
void setup() {
Particle.variable("GarageStatus", garageContact); // register a particle cloud variable called garage status with the value of the garageContact variable
pinMode(microswitch, INPUT_PULLDOWN); // set pin on microswitch as input with the pulldown resistor engaged
}
void loop() {
int status = digitalRead(microswitch); // read the microswitch pin and store the value to status
if (status == HIGH){ // check status if its high store open in the garageContact string
String garageContact = "open";
}
if (status == LOW){ // check status if its low store closed in the garageContact string
String garageContact = "closed";
}
}
its the particle variable that you would call with the smartthings app. If you look at my example for the pool controller you see my blurb that asks the photon for the variable and it would look like this to send for our sample “GarageStatus” variable…
httpGet("https://api.particle.io/v1/devices/yourdeviceID/GarageStatus?access_token=youraccessToken", closure)
if its not clear as mud or doesnt work let me know as we should be able to put our feeble crappy coding minds together and get something to work