asd
Dependencies: DS18B20Sensor mbed
Revision 0:765def67b2b6, committed 2014-04-10
- Comitter:
- umairaftab
- Date:
- Thu Apr 10 00:02:15 2014 +0000
- Commit message:
- working;
Changed in this revision
diff -r 000000000000 -r 765def67b2b6 DS18B20Sensor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DS18B20Sensor.lib Thu Apr 10 00:02:15 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/jsteve/code/DS18B20Sensor/#9fd95d590149
diff -r 000000000000 -r 765def67b2b6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 10 00:02:15 2014 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "DS18B20Sensor.h" + +// Instantiate sensor with hardware in pin p30 +DS18B20Sensor sensor(PTB4); + +// Setup a window to the world +//Serial pc(p13, p14); +Serial pc(USBTX, USBRX); + +int main() +{ + char sensorBuf[25]; + + // count will search for sensors, if not already called + pc.printf("Found %d sensor/s\r", sensor.count()); + + uint8_t result = sensor.startReading(true); // start sensor readings and wait + + for (uint8_t i = 0; i < sensor.count(); i++) { + sensor.getReading(sensorBuf, i); // get result into buf + pc.printf("Sensor %d : %s\r", i+1, sensorBuf); // display it to the world + } + +} \ No newline at end of file
diff -r 000000000000 -r 765def67b2b6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 10 00:02:15 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079 \ No newline at end of file