Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I received my LPC1768 controller today so I thought I would fire it up to see if I could make it do something simple. This is a modified version of "Hello World" which cycles through all 4 LEDs, just to see if I could properly address them in sequence.
--#include "mbed.h" DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); int main() { int i; DigitalOut *myled; i=0; while (1) { switch (i) { case 0: myled=&myled1; break; case 1: myled=&myled2; break; case 2: myled=&myled3; break; case 3: myled=&myled4; break; default: break; } *myled = 1; wait(0.5); *myled = 0; wait(0.5); i++; i=i%4; } }---