Luis Silvio Cordova Rivadeneira
/
UPSM_PARALLEL_PORT
Puerto paralelo
main.cpp
- Committer:
- lscordovar
- Date:
- 2020-02-07
- Revision:
- 0:8eca3dc705c6
File content as of revision 0:8eca3dc705c6:
#include "mbed.h " DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); int main() { while(1) { led1 = 1; led2 = 0; led3 = 0; led4 = 0; wait(0.25); led1 = 0; led2 = 1; led3 = 0; led4 = 0; wait(0.25); led1 = 0; led2 = 0; led3 = 1; led4 = 0; wait(0.25); led1 = 0; led2 = 0; led3 = 0; led4 = 1; wait(0.25); } } /* Using digital outputs, create a program to produce a “Knightrider” LED sweep effect with the on-board LEDs. */ #include "mbed.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); int main() { while(1) { led1 = 1; led2 = 0; led3 = 0; led4 = 0; wait(0.25); led1 = 0; led2 = 1; led3 = 0; led4 = 0; wait(0.25); led1 = 0; led2 = 0; led3 = 1; led4 = 0; wait(0.25); led1 = 0; led2 = 0; led3 = 0; led4 = 1; wait(0.25); led1 = 0; led2 = 0; led3 = 1; led4 = 0; wait(0.25); led1 = 0; led2 = 1; led3 = 0; led4 = 0; wait(0.25); } } #include "mbed.h" BusOut myleds(LED4, LED3, LED2, LED1); char x=1; int main() { while(1) { for(int i=0; i<3; i++) { // x = a << b then x = a*2^b; x = x << 1; // x=1,2,4,8 or x=0001,0010,0100,1000 myleds=x; // sweep left wait(0.2); } for(int i=0; i<3; i++) { // x = a >> b then x = a/2^b; x = x >> 1; // x=8,4,2,1 or x=1000,0100,0010,0001 myleds=x; // sweep right wait(0.2); } } } /* LCD https://os.mbed.com/media/uploads/robt/mbed_course_notes_-_parallel_comms.pdf I2C https://os.mbed.com/media/uploads/robt/mbed_course_notes_-_serial_i2c.pdf SPI https://os.mbed.com/media/uploads/robt/mbed_course_notes_-_serial_spi.pdf Memory and data management https://os.mbed.com/media/uploads/robt/mbed_course_notes_-_memory_and_data.pdf Timers and interrupts https://os.mbed.com/media/uploads/robt/mbed_course_notes_-_timers_and_interrupts.pdf */