This is a full demo that connects to mbed Device Server. It is used with a I2C Grove Color sensor, so it should be compatible on all platforms that support Ethernet.
Dependencies: ColorDetectorV2 EthernetInterface mbed-rtos mbed nsdl
Fork of nespresso_endpoint by
mbed Software Configuration
The default mbed Device Server (NSP or mDS) configuration is used by an instance of the web app (Barista) here: http://barista-test.cloudapp.net:4005.
In main.cpp, find the following lines:
// **************************************************************************** // Configuration section // I2C Settings #define COLOR_SENSOR_SCL I2C_SCL #define COLOR_SENSOR_SDA I2C_SDA // Ethernet configuration /* Define this to enable DHCP, otherwise manual address configuration is used */ #define DHCP /* Manual IP configurations, if DHCP not defined */ #define IP "0.0.0.0" #define MASK "255.255.255.0" #define GW "0.0.0.0" // NSP configuration /* Change this IP address to that of your mbed Device Server installation if you're not using mbed Connector */ static const char* NSP_ADDRESS = "api.connector.mbed.org"; static const int NSP_PORT = 5683; char endpoint_name[] = "nespresso-machine-ethernet"; uint8_t ep_type[] = {"nespresso-endpoint"}; char nsp_domain[] = "56645321f5e24c49908e42f4d71b9ccb"; uint8_t lifetime_ptr[] = {"1200"}; // ****************************************************************************
Edit COLOR_SENSOR_SCL
and COLOR_SENSOR_SDA
to the appropriate I2C pins on your mbed platform.
You should not edit the DHCP/static IP settings if you are not using a static IP address. If you are using a static IP address, provide the appropriate information and remove the following line:
#define DHCP
Change endpoint_name
to uniquely identify your Nespresso endpoint.
If you are using mbed Connector, change the nsp_domain
string to your domain.
If you are using your own installation of mDS, you should change NSP_ADDRESS
to the url of your mDS installation, NSP_PORT
if you're using a non default port on mDS for CoAP, and nsp_domain
to a valid domain on your mDS instance ("domain" is the default mDS domain).
History
Updating ColorDetectorV2 (default to 3.3v)
2015-07-16, by bridadan [Thu, 16 Jul 2015 18:32:49 +0000] rev 15
Updating ColorDetectorV2 (default to 3.3v)
Updating ColorDetectorV2 and increasing sensor gain
2015-07-16, by bridadan [Thu, 16 Jul 2015 16:24:14 +0000] rev 14
Updating ColorDetectorV2 and increasing sensor gain
Updating endpoint to use ColorDetectorV2. Removed timeout from server receive.
2015-07-15, by bridadan [Wed, 15 Jul 2015 17:24:38 +0000] rev 13
Updating endpoint to use ColorDetectorV2. Removed timeout from server receive.
Fixed potential timing issue.
2015-07-03, by bridadan [Fri, 03 Jul 2015 04:48:43 +0000] rev 12
Fixed potential timing issue.
Updating ColorDetector again
2015-07-02, by bridadan [Thu, 02 Jul 2015 01:44:16 +0000] rev 11
Updating ColorDetector again
Updating ColorDetector
2015-07-02, by bridadan [Thu, 02 Jul 2015 01:07:50 +0000] rev 10
Updating ColorDetector
Using mbed Connector
2015-07-01, by bridadan [Wed, 01 Jul 2015 12:14:29 +0000] rev 9
Using mbed Connector
Made detection more "picky" by requiring less variance between measurements.
2015-06-30, by bridadan [Tue, 30 Jun 2015 01:37:33 +0000] rev 8
Made detection more "picky" by requiring less variance between measurements.
Updated endpoint to use new ColorDetector version
2015-06-02, by bridadan [Tue, 02 Jun 2015 22:20:02 +0000] rev 7
Updated endpoint to use new ColorDetector version
Fixed update registration issue
2015-05-19, by bridadan [Tue, 19 May 2015 19:17:41 +0000] rev 6
Fixed update registration issue