Example using Electricity sensor
Dependencies: mbed
Fork of Seeed_Grove_Moisture_Sensor_Example by
main.cpp@0:780321a3f63a, 2014-08-16 (annotated)
- Committer:
- sam_grove
- Date:
- Sat Aug 16 00:34:43 2014 +0000
- Revision:
- 0:780321a3f63a
- Child:
- 1:894d3b3f26e8
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 0:780321a3f63a | 1 | |
sam_grove | 0:780321a3f63a | 2 | #include "mbed.h" |
sam_grove | 0:780321a3f63a | 3 | |
sam_grove | 0:780321a3f63a | 4 | AnalogIn moisture(A0); |
sam_grove | 0:780321a3f63a | 5 | |
sam_grove | 0:780321a3f63a | 6 | int main(void) |
sam_grove | 0:780321a3f63a | 7 | { |
sam_grove | 0:780321a3f63a | 8 | float value = 0.0f; |
sam_grove | 0:780321a3f63a | 9 | |
sam_grove | 0:780321a3f63a | 10 | while(1) { |
sam_grove | 0:780321a3f63a | 11 | value = moisture; |
sam_grove | 0:780321a3f63a | 12 | printf("Moisture reading is %2.2f\n", value); |
sam_grove | 0:780321a3f63a | 13 | wait(1.0f); |
sam_grove | 0:780321a3f63a | 14 | } |
sam_grove | 0:780321a3f63a | 15 | } |