exemple d'utilisation de l'IHM NBOARD (IUT Cachan).
Dependencies: IHM_NBOARD mbed
Nboard_IHM.cpp@15:6d9f90ee99ce, 2016-11-07 (annotated)
- Committer:
- gr66
- Date:
- Mon Nov 07 13:23:22 2016 +0000
- Revision:
- 15:6d9f90ee99ce
- Parent:
- Nboard.cpp@14:4df60a00f825
- Child:
- 16:c4bfe797dfaf
Exemple NBoard IHM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gr66 | 8:0bbcd33e7811 | 1 | #include "IHM.h" |
gr66 | 12:af99168c1a11 | 2 | IHM ihm; //clase IHM |
gr66 | 15:6d9f90ee99ce | 3 | Serial pc(USBTX, USBRX); // I/O terminal PC |
gr66 | 8:0bbcd33e7811 | 4 | int main() |
gr66 | 8:0bbcd33e7811 | 5 | { |
gr66 | 12:af99168c1a11 | 6 | UINT8 codeur=0,jog; |
gr66 | 8:0bbcd33e7811 | 7 | float pi=4*atan(1.0); |
gr66 | 15:6d9f90ee99ce | 8 | ihm.LCD_gotoxy(0,1); |
gr66 | 11:7cfa7c991676 | 9 | pc.printf("Hello World \n"); |
gr66 | 12:af99168c1a11 | 10 | ihm.LCD_clear(); |
gr66 | 12:af99168c1a11 | 11 | ihm.LCD_gotoxy(0,4); |
gr66 | 15:6d9f90ee99ce | 12 | ihm.LCD_printf("Hello World "); |
gr66 | 8:0bbcd33e7811 | 13 | ihm.LCD_gotoxy(1,0); |
gr66 | 8:0bbcd33e7811 | 14 | ihm.LCD_printf("PI= %f",pi); // test affichage float |
gr66 | 8:0bbcd33e7811 | 15 | ihm.BAR_set(0x3FF); |
gr66 | 8:0bbcd33e7811 | 16 | wait(2); |
gr66 | 8:0bbcd33e7811 | 17 | ihm.BAR_set(0x2AA); |
gr66 | 8:0bbcd33e7811 | 18 | wait(2); |
gr66 | 8:0bbcd33e7811 | 19 | ihm.BAR_set(0x155); |
gr66 | 8:0bbcd33e7811 | 20 | wait(2); |
gr66 | 8:0bbcd33e7811 | 21 | ihm.LCD_clear(); |
gr66 | 8:0bbcd33e7811 | 22 | while(1) { |
gr66 | 15:6d9f90ee99ce | 23 | wait(0.5); |
gr66 | 12:af99168c1a11 | 24 | codeur=ihm.COD_read(); |
gr66 | 12:af99168c1a11 | 25 | jog=ihm.JOG_read(); |
gr66 | 12:af99168c1a11 | 26 | ihm.BAR_set((UINT16)(codeur)); |
gr66 | 8:0bbcd33e7811 | 27 | ihm.LCD_gotoxy(0,0); |
gr66 | 12:af99168c1a11 | 28 | ihm.LCD_printf("Jog=%02d",jog); |
gr66 | 8:0bbcd33e7811 | 29 | ihm.LCD_gotoxy(1,0); |
gr66 | 12:af99168c1a11 | 30 | ihm.LCD_printf("Cod=%03d",codeur); |
gr66 | 12:af99168c1a11 | 31 | pc.printf("Jog=%02d Cod=%03d \n",jog,codeur); |
gr66 | 8:0bbcd33e7811 | 32 | } |
gr66 | 8:0bbcd33e7811 | 33 | } |