Example program to create IoT devices for a local network, which connect to a local server.
Dependencies: WebSocketClient WiflyInterface mbed messages
This code is used in the second part of my Internet of Things (IoT) blog post available here. The code is fairly simple, but its real value is in its reliability. I have worked hard to try to make the wireless connection as reliable, and as fast, as possible. There are a few lines of code that must be modified before it will work correctly, and those are described in the following Wiki pages.
It is designed to work with a Python WebSocket Server running on a PC, the source code of which is available here.
Once operating with the server, each microcontroller, or IoT device, will broadcast a counter and its internal temperature to your WebSocket Server.
headers/ADC.h@2:7abdaa5a9209, 2016-10-04 (annotated)
- Committer:
- defrost
- Date:
- Tue Oct 04 13:59:13 2016 +0000
- Revision:
- 2:7abdaa5a9209
- Parent:
- 1:4403f2ed1c1f
- Child:
- 6:424e225d2a91
- Internal temperature sensing works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
defrost | 1:4403f2ed1c1f | 1 | // ************ |
defrost | 1:4403f2ed1c1f | 2 | // * iQ_ADC.h * |
defrost | 1:4403f2ed1c1f | 3 | // ************ |
defrost | 1:4403f2ed1c1f | 4 | // |
defrost | 1:4403f2ed1c1f | 5 | // Created: 2015/03/19 |
defrost | 1:4403f2ed1c1f | 6 | // By: Damien Frost |
defrost | 1:4403f2ed1c1f | 7 | // |
defrost | 1:4403f2ed1c1f | 8 | // Description: |
defrost | 1:4403f2ed1c1f | 9 | // Setup and functions of the ADC Module. |
defrost | 1:4403f2ed1c1f | 10 | |
defrost | 1:4403f2ed1c1f | 11 | #ifndef IQ_ADC_H |
defrost | 1:4403f2ed1c1f | 12 | #define IQ_ADC_H |
defrost | 1:4403f2ed1c1f | 13 | |
defrost | 1:4403f2ed1c1f | 14 | // Properties of the internal temperature sensor: |
defrost | 1:4403f2ed1c1f | 15 | #define IT_VMIN 1.7f |
defrost | 1:4403f2ed1c1f | 16 | #define IT_VMAX 3.3f |
defrost | 1:4403f2ed1c1f | 17 | #define IT_AVG_SLOPE 0.0025f |
defrost | 1:4403f2ed1c1f | 18 | #define IT_V25 0.76f |
defrost | 1:4403f2ed1c1f | 19 | |
defrost | 1:4403f2ed1c1f | 20 | #define ADC_MAX 4095.0f |
defrost | 1:4403f2ed1c1f | 21 | |
defrost | 2:7abdaa5a9209 | 22 | #define STARTADCCONVERSION ADC1->CR2 |= ADC_CR2_SWSTART // This command starts the ADC Conversion. |
defrost | 2:7abdaa5a9209 | 23 | #define ADCCONVERSIONCOMPLETE ((ADC1->SR & ADC_SR_EOC) > 0) // This command returns true when the ADC conversion is complete. |
defrost | 1:4403f2ed1c1f | 24 | |
defrost | 1:4403f2ed1c1f | 25 | void ConfigureADC(void); |
defrost | 1:4403f2ed1c1f | 26 | |
defrost | 1:4403f2ed1c1f | 27 | |
defrost | 1:4403f2ed1c1f | 28 | #endif /* IQ_ADC_H */ |