アナログ入力のテスト(ジョイステック)

Dependencies:   TextLCD mbed

main.cpp

Committer:
yueee_yt
Date:
2011-12-26
Revision:
0:112b27ac26d5
Child:
1:b24f69657abc

File content as of revision 0:112b27ac26d5:

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
AnalogIn x(p19);
AnalogIn y(p20);

int main() {
    float xx,yy;
    lcd.cls();
    lcd.printf("ADC TEST\n");
    while (1) {
        lcd.locate(0,1);
        xx=(float)((int)(x.read()*100))/100.0;
        yy=(float)((int)(y.read()*100))/100.0;
        lcd.printf("x=%4.2f y=%4.2f",xx,yy);
        wait(0.1f);
    }
}