FRDM_wahadlo_torsyjne

Dependencies:   mbed BufferedSerial

Fork of FRDM_wahadlo_torsyjne by Wojciech M

main.cpp

Committer:
wojtekmir
Date:
2014-05-12
Revision:
1:a4f9276a0f35
Parent:
0:55d4b368d771
Child:
2:78a032749524

File content as of revision 1:a4f9276a0f35:

#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
        
    }
}