Emmanuel Edwards
/
Hexi_Serial_Example
modified serial for HX711 readout
Fork of Hexi_Serial_Example by
main.cpp@0:79c0c4cd1ab3, 2016-08-15 (annotated)
- Committer:
- GregC
- Date:
- Mon Aug 15 03:58:02 2016 +0000
- Revision:
- 0:79c0c4cd1ab3
- Child:
- 1:cad368af277b
Hexiwear Serial project
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GregC | 0:79c0c4cd1ab3 | 1 | #include "mbed.h" |
GregC | 0:79c0c4cd1ab3 | 2 | |
GregC | 0:79c0c4cd1ab3 | 3 | DigitalOut myled(LED_BLUE); |
GregC | 0:79c0c4cd1ab3 | 4 | Serial pc(USBTX, USBRX); |
GregC | 0:79c0c4cd1ab3 | 5 | |
GregC | 0:79c0c4cd1ab3 | 6 | int main() |
GregC | 0:79c0c4cd1ab3 | 7 | { |
GregC | 0:79c0c4cd1ab3 | 8 | int i = 0; |
GregC | 0:79c0c4cd1ab3 | 9 | pc.printf("Hello World!\n"); |
GregC | 0:79c0c4cd1ab3 | 10 | |
GregC | 0:79c0c4cd1ab3 | 11 | while (true) { |
GregC | 0:79c0c4cd1ab3 | 12 | wait(0.5f); // wait a small period of time |
GregC | 0:79c0c4cd1ab3 | 13 | pc.printf("%d \n", i); // print the value of variable i |
GregC | 0:79c0c4cd1ab3 | 14 | i++; // increment the variable |
GregC | 0:79c0c4cd1ab3 | 15 | myled = !myled; // toggle a led |
GregC | 0:79c0c4cd1ab3 | 16 | } |
GregC | 0:79c0c4cd1ab3 | 17 | } |
GregC | 0:79c0c4cd1ab3 | 18 |