Wojciech M
/
FRDM_wahadlo_torsyjne
.
Diff: main.cpp
- Revision:
- 1:a4f9276a0f35
- Parent:
- 0:55d4b368d771
--- a/main.cpp Mon May 12 11:29:57 2014 +0000 +++ b/main.cpp Mon May 12 11:33:36 2014 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +PwmOut motor(PTA5); // A green led is connected at Pin25 with resistor to ground +int motor_period = 100; + +DigitalOut myled(LED_GREEN); +Serial pc(USBTX,USBRX); + +AnalogIn ain0(PTB0); +AnalogIn ain1(PTB1); +AnalogIn ain2(PTB2); +AnalogIn ain3(PTB3); + +int main() { + +// pc.printf("\nHello World!\n"); + + motor.period_us(motor_period); + motor = 0.5f; //wypełnienie zawsze 50% + pc.baud(115200); + while (true) { + wait(0.1); + pc.printf("a0:%d\n",ain0.read_u16()); + pc.printf("a1:%d\n",ain1.read_u16()); + pc.printf("a2:%d\n",ain2.read_u16()); + pc.printf("a3:%d\n",ain3.read_u16()); + myled = !myled; + //zmiana czestotliwosci ifami tutaj + + } +}