Closed Ben1015 closed 6 years ago
the ^1 is the code that makes the inverse of the input so, you could add one more line so it becomes:
new=GPIO_INPUT(GPIO_Pin_2)^1; //get new state
GPIO_OUTPUT(GPIO_Pin_2,new); //toggle
new=new^1; //inverted value
gpio2.value->type=new;
Don't forget about the rest of the code (init?) Trial and error is also a way of learning...
Ok! Thanks!
Helllo,
In the example led-button, instead of the routine interrupt on GPIO0:
new=GPIO_INPUT(GPIO_Pin_2)^1; //get new state
GPIO_OUTPUT(GPIO_Pin_2,new); //toggle
gpio2.value->type=new;
change_value( gpio2.aid,gpio2.iid,gpio2.value);
send_events(NULL,gpio2.aid,gpio2.iid);
I would like to inverse the value of gpio2.value, something like this :
gpio2.value=!gpio2.value;
=> What is the operator for a struct cJSON *?change_value( gpio2.aid,gpio2.iid,gpio2.value);
send_events(NULL,gpio2.aid,gpio2.iid);
Is it possible?Thanks