Alexey Antanenko
/
w5100 web server
w5100 hello world web server
main.cpp
- Committer:
- antanenko
- Date:
- 2016-01-24
- Revision:
- 2:ca9ab1eabb45
- Parent:
- 1:fbc8f7bb7288
File content as of revision 2:ca9ab1eabb45:
#include "mbed.h" Serial pc(USBTX,USBRX); Serial pc2(PB_6,PB_7); // change DigitalOut led1(LED1); DigitalOut led2(PB_4); DigitalOut led3(PB_5); int main() { pc.baud(115200); pc2.baud(115200); pc.printf("hello world\n");//you can print through function("pc.printf") described on mbed library of C while(1) { pc2.printf("Second uart\n"); pc.printf("RED led blinks\n");//you can print through C's own print function led1=0; led2=1; led3=1; wait(0.5); pc.printf("GREEN led blinks\n");//you can print through C's own print function led1=1; led2=0; led3=1; wait(0.5); pc.printf("BLUE led blinks\n");//you can print through C's own print function led1=1; led2=1; led3=0; wait(0.5); } } /* #python code for LED and "hello world" over serial #compile thid code and generate ".bin" file and download it to your FRDM-KL25Z flash #from http://pymbed.appspot.com/ online python compiler import mbed import sys led1 = mbed.DigitalOut('LED_RED') led2 = mbed.DigitalOut('LED_GREEN') led3 = mbed.DigitalOut('LED_BLUE') pc = mbed.Serial('PTA2', 'PTA1') pc.baud(9600) pc.writeable() pc.puts('Hello world \n')#you can print through function("puts") described on mbed library of python while 1: print('RED led blinks\n')#you can print through python's own print function led1.write(0) led2.write(1) led3.write(1) sys.wait(500) print('GREEN led blinks\n')#you can print through python's own print function led1.write(1) led2.write(0) led3.write(1) sys.wait(500) print('BLUE led blinks\n')#you can print through python's own print function led1.write(1) led2.write(1) led3.write(0) sys.wait(500) */