ThingPlug Ex
Dependencies: DHT11 NetworkSocketAPI WizFi310Interface mbed
Fork of WizFi310_ThingPlug_Test by
Revision 7:8ad9f9bd39b3, committed 2017-10-19
- Comitter:
- cliff1
- Date:
- Thu Oct 19 04:38:50 2017 +0000
- Parent:
- 6:ece3b06b9aba
- Child:
- 8:0ebb9e4549f9
- Commit message:
- ThingPlug+ 171019
Changed in this revision
| WizFi310Interface.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/WizFi310Interface.lib Fri Sep 29 00:22:50 2017 +0000 +++ b/WizFi310Interface.lib Thu Oct 19 04:38:50 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/cliff1/code/WizFi310Interface/#08588dd2a66f +https://developer.mbed.org/users/cliff1/code/WizFi310Interface/#90902218e268
--- a/main.cpp Fri Sep 29 00:22:50 2017 +0000
+++ b/main.cpp Thu Oct 19 04:38:50 2017 +0000
@@ -35,13 +35,15 @@
#define CDS_SENSOR CDS_Sensor
#define DHT_SENSOR DHT_Sensor
+#define LED LED_Sensor
#if defined(TARGET_WIZwiki_W7500)
Serial pc(USBTX, USBRX);
WizFi310Interface wifi(D1, D0, D7, D6, D9, NC, 115200);
- AnalogIn myLux( CDS_SENSOR );
- Dht11 myTemp ( DHT_SENSOR );
+ AnalogIn myLux( CDS_SENSOR );
+ Dht11 myTemp( DHT_SENSOR );
+ DigitalOut myled( LED );
#endif
@@ -97,7 +99,21 @@
else if(c == 'r' || c == 'R')
{
- wifi.recvTP(COMMAND_NM, 3, 0);
+ int a;
+
+ a = wifi.recvTP(COMMAND_NM, 3, 0);
+
+ if( a == 1 )
+ {
+ printf("Turn On!\r\n\r\n");
+ myled = 1;
+ }
+
+ else if( a == 2)
+ {
+ printf("Turn OFF!\r\n\r\n");
+ myled = 0;
+ }
wait_ms(3000);
}
