mr happy
/
flashing_leds
Reads the voltage from Pin18 (out) based on the output from Pin(20) i.e a self checking voltmeter.
main.cpp
- Committer:
- mrhappy
- Date:
- 2011-02-04
- Revision:
- 0:7c659fdad918
- Child:
- 1:a4c99d145ce3
File content as of revision 0:7c659fdad918:
#include "mbed.h" AnalogIn ain(p20); DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); // use pin 20 and GND to display a binary read out on the lights // of the voltage across the pins. // did not validate this in anyway. // mrhappy void bindisplay(int i){ // based on Kohei Matsumura code. wait(0.2); led1 = i & 0x01; led2 = i>>1 & 0x01; led3 = i>>2 & 0x01; led4 = i>>3 & 0x01; } int main() { while (1){ bindisplay( ain * 0x0f ); } }