Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FINAL_PROJECT_4180 WebSocketClient WiflyInterface mbed-rtos mbed
Fork of Websocket_Wifly_HelloWorld by
Revision 3:b88f93478f07, committed 2016-11-23
- Comitter:
- xemnas214
- Date:
- Wed Nov 23 01:09:13 2016 +0000
- Parent:
- 2:c69a06fe81c0
- Commit message:
- IOTLOCK 1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FINAL_PROJECT_4180.lib Wed Nov 23 01:09:13 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/xemnas214/code/FINAL_PROJECT_4180/#ca57ad53761b
--- a/WiflyInterface.lib Fri Aug 24 14:06:31 2012 +0000 +++ b/WiflyInterface.lib Wed Nov 23 01:09:13 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/WiflyInterface/#fb4494783863 +https://developer.mbed.org/users/xemnas214/code/WiflyInterface/#7eb2984bc677
--- a/main.cpp Fri Aug 24 14:06:31 2012 +0000
+++ b/main.cpp Wed Nov 23 01:09:13 2016 +0000
@@ -1,8 +1,9 @@
#include "mbed.h"
+#include "rtos.h"
#include "WiflyInterface.h"
#include "Websocket.h"
-
-
+#include "FPScanner.h"
+#include "lib.h"
/* wifly interface:
* - p9 and p10 are for the serial communication
* - p19 is for the reset pin
@@ -11,18 +12,59 @@
* - "password" is the password
* - WPA is the security
*/
-WiflyInterface wifly(p9, p10, p19, p26, "mbed", "password", WPA);
-
+Serial pc(USBTX, USBRX);
+FPScanner finger(p28,p27);
+DigitalIn isEnroll(p22);
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled4(LED4);
+DigitalOut otherLock(p21);
+WiflyInterface wifly(p9, p10, p18, p19, "SuperWifi", "00000000", WPA);
+float position = 0;
+float oldPosition = 0;
+void fingerLock(void const *agrs){
+ while(1) {
+ //fp_enroll(&finger, &debug);
+ if (isEnroll){
+ printf("Enrolling\n\r");
+ fp_enroll(&finger);
+ printf("Enrolled\n\r");
+ }
+ if(fp_auth(&finger)){
+ myled1 = !myled1;
+ position = 1.0 - position;
+ otherLock = position;
+ }
+ myled2 = !myled2;
+ Thread::wait(500);
+ }
+}
int main() {
+ char recv[100];
+ printf("Started\n\r");
wifly.init(); //Use DHCP
- while (!wifly.connect());
+ printf("Init\n\r");
+ while(!wifly.connect());
+ printf("Wifly Connected\n\r");
printf("IP Address is %s\n\r", wifly.getIPAddress());
-
- Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo");
- while (!ws.connect());
-
+ Websocket ws("ws://192.168.43.154:8888/ws");
+ while(!ws.connect());
+ printf("Socket connected\n\r");
+ ws.send(new char('0'));
+
+ finger.Open();
+ Thread thread1(fingerLock);
+ printf("Finger created\n\r");
+
while (1) {
- ws.send("WebSocket Hello World over Wifly");
- wait(1.0);
+ if (ws.read(recv)) {
+ sscanf(recv,"%f",&position);
+ }
+ if (oldPosition != position){
+ ws.send(new char(position + '0'));
+ }
+ oldPosition = position;
+ otherLock = position;
+ myled4 = otherLock;
}
}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Wed Nov 23 01:09:13 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#02f5cf381388
