Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
example.cpp@8:3c53e18e16e6, 2016-10-27 (annotated)
- Committer:
- gakuburu
- Date:
- Thu Oct 27 08:56:42 2016 +0000
- Revision:
- 8:3c53e18e16e6
example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gakuburu | 8:3c53e18e16e6 | 1 | #include "mbed.h" |
gakuburu | 8:3c53e18e16e6 | 2 | #include "LambdaController.h" |
gakuburu | 8:3c53e18e16e6 | 3 | |
gakuburu | 8:3c53e18e16e6 | 4 | int main(void) |
gakuburu | 8:3c53e18e16e6 | 5 | { |
gakuburu | 8:3c53e18e16e6 | 6 | Serial pc(USBTX, USBRX); |
gakuburu | 8:3c53e18e16e6 | 7 | pc.baud(9600); |
gakuburu | 8:3c53e18e16e6 | 8 | |
gakuburu | 8:3c53e18e16e6 | 9 | LambdaController con(D1, D0); |
gakuburu | 8:3c53e18e16e6 | 10 | |
gakuburu | 8:3c53e18e16e6 | 11 | con.initialize_axis(); |
gakuburu | 8:3c53e18e16e6 | 12 | |
gakuburu | 8:3c53e18e16e6 | 13 | while(1) |
gakuburu | 8:3c53e18e16e6 | 14 | { |
gakuburu | 8:3c53e18e16e6 | 15 | if (con.get_error()) |
gakuburu | 8:3c53e18e16e6 | 16 | { |
gakuburu | 8:3c53e18e16e6 | 17 | pc.printf("error : %d\r\n", con.get_error()); |
gakuburu | 8:3c53e18e16e6 | 18 | } |
gakuburu | 8:3c53e18e16e6 | 19 | else |
gakuburu | 8:3c53e18e16e6 | 20 | { |
gakuburu | 8:3c53e18e16e6 | 21 | pc.printf("buttons : %x\r\n", con.get_all_switch()); |
gakuburu | 8:3c53e18e16e6 | 22 | pc.printf("1 : %d\r\n", con.get_switch(0)); |
gakuburu | 8:3c53e18e16e6 | 23 | // pc.printf("joystick0 : %f\r\n", con.get_axis(con.Stick0X)); |
gakuburu | 8:3c53e18e16e6 | 24 | // pc.printf("joystick1 : %f\r\n", con.get_axis(con.Stick0Y)); |
gakuburu | 8:3c53e18e16e6 | 25 | // pc.printf("joystick2 : %f\r\n", con.get_axis(con.Stick1X)); |
gakuburu | 8:3c53e18e16e6 | 26 | // pc.printf("joystick3 : %f\r\n", con.get_axis(con.Stick1Y)); |
gakuburu | 8:3c53e18e16e6 | 27 | } |
gakuburu | 8:3c53e18e16e6 | 28 | } |
gakuburu | 8:3c53e18e16e6 | 29 | } |