
lab 3
Dependencies: mbed mbed-rtos tsi_sensor SLCD
Diff: main.cpp
- Revision:
- 1:03ee5f19d879
- Parent:
- 0:78b84e1ce9df
- Child:
- 2:b94b72891752
--- a/main.cpp Tue Feb 18 21:16:23 2020 +0000 +++ b/main.cpp Wed Feb 19 01:26:00 2020 +0000 @@ -51,24 +51,24 @@ //Pushbuttons (active-low), digital input or interrupt input //pins need pull-up resistors -DigitalIn left_button(PTC12, PullUp); +//DigitalIn left_button(PTC12, PullUp); //InterruptIn left_button(PTC12, PullUp); -DigitalIn right_button(PTC3, PullUp); +//DigitalIn right_button(PTC3, PullUp); //InterruptIn right_button(PTC3, PullUp); //User LEDs -DigitalOut red_led(PTE29); -DigitalOut green_led(PTD5); +//DigitalOut red_led(PTE29); +//DigitalOut green_led(PTD5); //Light sensor (phototransistor) -AnalogIn light_sensor(PTE22); +//AnalogIn light_sensor(PTE22); //Temperature sensor(LM34) -AnalogIn LM34(PTC2); +//AnalogIn LM34(PTC2); //Speakers -PwmOut speaker1(PTE21); -PwmOut Speaker2(PTE23); +//PwmOut speaker1(PTE21); +//PwmOut Speaker2(PTE23); // All of the follwoing define "pc" identically Serial pc(USBTX, USBRX); // MBED standard pin names @@ -129,9 +129,9 @@ void vt100_set_background(vt100_colors color) */ -#include "SLCD.h" +//#include "SLCD.h" //slcd is the 4-digit, 7-segment LCD on the KL46Z -SLCD slcd; +//SLCD slcd; /* available functions */ /* slcd.printf("1234"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display @@ -145,7 +145,7 @@ slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest */ -#include "tsi_sensor.h" +//#include "tsi_sensor.h" //Touch Sensitive Interface #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) #define ELEC0 9 @@ -156,12 +156,12 @@ #else #error TARGET NOT DEFINED #endif -TSIAnalogSlider tsi(ELEC0, ELEC1, 40); +//TSIAnalogSlider tsi(ELEC0, ELEC1, 40); /* available functions */ /* float TSIAnalogSlider.readPercentage() */ -#include "keypad4x4.h" +//#include "keypad4x4.h" //BusOut keypad4x4_columns(PTE19, PTE18, PTE17, PTE16); //BusIn keypad4x4_rows(PTA14, PTA15, PTA16, PTA17); //InterruptIn keypad4x4_interrupt(PTC16); @@ -175,7 +175,7 @@ */ #include "NKC_LCD.h" -Serial lcd(PTD3,NC); +//Serial lcd(PTD3,NC); //Serial lcd(J1_6,NC); //available functions: /* @@ -202,22 +202,22 @@ */ //Stepper motor driver (ULN2803A) -BusOut stepper(PTB0, PTB1, PTB2, PTB3); +//BusOut stepper(PTB0, PTB1, PTB2, PTB3); //BusOut stepper(J4_2, J4_4, J4_6, J4_8); //DC Quad Half-Hmotor driver (SN754410) -DigitalOut motor_1(PTB20); -DigitalOut motor_2(PTE30); -DigitalOut motor_3(PTB18); -DigitalOut motor_4(PTB19); -PwmOut motor_enable_12(PTA6); -PwmOut motor_enable_34(PTA7); +//DigitalOut motor_1(PTB20); +//DigitalOut motor_2(PTE30); +//DigitalOut motor_3(PTB18); +//DigitalOut motor_4(PTB19); +//PwmOut motor_enable_12(PTA6); +//PwmOut motor_enable_34(PTA7); //DigitalOut motor_enable_12(PTA6); //DigitalOut motor_enable_34(PTA7); //Servo motors -PwmOut servo1(PTA4); -PwmOut servo2(PTA5); +//PwmOut servo1(PTA4); +//PwmOut servo2(PTA5); //Inter-integrated circuit bus //I2C i2c0(PTE25, PTE24); //internal I2C bus for accelerometer and magnetometer @@ -247,10 +247,12 @@ int main() { pc.baud(115200); + pc.printf("\nStarting\n"); + pc.printf("lcd baud decode %i\n",lcd_baud_decode(115200)); lcd_default_baud(115200); - lcd_baud(115200); + pc.printf("lcd baud %i\n",lcd_baud(115200)); uart1.baud(115200); - slcd.All_Segments(0); + // slcd.All_Segments(0);