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: LM75B Color mbed yeswecancoap Rgb
Diff: main.cpp
- Revision:
- 2:ba4506b61052
- Parent:
- 1:e0a4afdbbffb
diff -r e0a4afdbbffb -r ba4506b61052 main.cpp
--- a/main.cpp Fri Oct 23 14:48:16 2015 +0000
+++ b/main.cpp Tue Jan 19 00:13:37 2016 +0000
@@ -1,14 +1,19 @@
+//include the libary's
+
#include "mbed.h"
#include "coap.h"
#include "rgb.h"
#include "LM75B.h"
+//initialise serial en the temperature sensor
Serial pc(USBTX, USBRX);
LM75B sensor(p28,p27);
+//make a object from the class RGB
RGB* rgb;
-
-void get_hello(Request* req, Response* res)
+//the methode to send the value of the temp sensor
+//this methode is called by a get methode
+void get_temp(Request* req, Response* res)
{
if(req->hasContent()) {
@@ -21,11 +26,14 @@
res -> setCode(CONTENT);
}
+//this methode receive the value of the LED
+//
void post_led(Request* req, Response* res)
{
if(req->hasContent()) {
- //rgb->setColor(req,req,req);
+ //receive the coap data
char* test = req->getContent();
+
pc.printf(test);
uint32_t hex = strtol(req->getContent(), NULL, 16);
rgb->setColor(hex);
@@ -38,7 +46,7 @@
int main()
{
Server server;
- server.add("/led", &get_hello, GET);
+ server.add("/led", &get_temp, GET);
server.add("/led", &post_led, POST);
rgb = new RGB(p23, p24, p25);