joystick_bjk

Dependencies:   mbed VL53L1X

Committer:
Bhoney
Date:
Sun Aug 25 19:55:53 2019 +0000
Revision:
0:6f0f41537e2f
Child:
1:fd1e7e2d0780
-;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bhoney 0:6f0f41537e2f 1 #include "mbed.h"
Bhoney 0:6f0f41537e2f 2
Bhoney 0:6f0f41537e2f 3 /*------------------------------------------------------------------------------
Bhoney 0:6f0f41537e2f 4 Before to use this example, ensure that you an hyperterminal installed on your
Bhoney 0:6f0f41537e2f 5 computer. More info here: https://developer.mbed.org/handbook/Terminals
Bhoney 0:6f0f41537e2f 6
Bhoney 0:6f0f41537e2f 7 The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their
Bhoney 0:6f0f41537e2f 8 definition in the PinNames.h file).
Bhoney 0:6f0f41537e2f 9
Bhoney 0:6f0f41537e2f 10 The default serial configuration in this case is 9600 bauds, 8-bit data, no parity
Bhoney 0:6f0f41537e2f 11
Bhoney 0:6f0f41537e2f 12 If you want to change the baudrate for example, you have to redeclare the
Bhoney 0:6f0f41537e2f 13 serial object in your code:
Bhoney 0:6f0f41537e2f 14
Bhoney 0:6f0f41537e2f 15 Serial pc(SERIAL_TX, SERIAL_RX);
Bhoney 0:6f0f41537e2f 16
Bhoney 0:6f0f41537e2f 17 Then, you can modify the baudrate and print like this:
Bhoney 0:6f0f41537e2f 18
Bhoney 0:6f0f41537e2f 19 pc.baud(115200);
Bhoney 0:6f0f41537e2f 20 pc.printf("Hello World !\n");
Bhoney 0:6f0f41537e2f 21 ------------------------------------------------------------------------------*/
Bhoney 0:6f0f41537e2f 22
Bhoney 0:6f0f41537e2f 23 DigitalOut led(LED1);
Bhoney 0:6f0f41537e2f 24
Bhoney 0:6f0f41537e2f 25 int main()
Bhoney 0:6f0f41537e2f 26 {
Bhoney 0:6f0f41537e2f 27 int i = 1;
Bhoney 0:6f0f41537e2f 28
Bhoney 0:6f0f41537e2f 29 printf("Hello World !\n");
Bhoney 0:6f0f41537e2f 30
Bhoney 0:6f0f41537e2f 31 while(1) {
Bhoney 0:6f0f41537e2f 32 wait(1); // 1 second
Bhoney 0:6f0f41537e2f 33 led = !led; // Toggle LED
Bhoney 0:6f0f41537e2f 34 printf("This program runs since %d seconds.\n", i++);
Bhoney 0:6f0f41537e2f 35 }
Bhoney 0:6f0f41537e2f 36 }