29.04.2015 Views

DevKit8500D/A User Manual - DMCS Pages for Students

DevKit8500D/A User Manual - DMCS Pages for Students

DevKit8500D/A User Manual - DMCS Pages for Students

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

eturn -1;<br />

}<br />

if((f_led2 = open(LED2, O_RDWR)) < 0){<br />

printf("error in open %s",LED2);<br />

return -1;<br />

}<br />

if((f_led3 = open(LED3, O_RDWR)) < 0){<br />

printf("error in open %s",LED3);<br />

return -1;<br />

}<br />

<strong>for</strong>(;;){<br />

i++;<br />

dat1 = i&0x1 ? '1':'0';<br />

dat2 = (i&0x2)>>1 ? '1':'0';<br />

dat3 = (i&0x4)>>2 ? '1':'0';<br />

write(f_led1, &dat1, sizeof(dat1));<br />

write(f_led2, &dat2, sizeof(dat2));<br />

write(f_led3, &dat3, sizeof(dat3));<br />

usleep(300000);<br />

}<br />

}<br />

2) To Cross-compile<br />

arm-none-linux-gnueabi-gcc led_acc.c -o led_acc<br />

3) Download and run<br />

Upload to the development board system through TF card, USB flash disk or network, enter the<br />

directory with the led_acc file, input the following commands and press Enter, to run led_acc in the<br />

background.<br />

./led_acc &<br />

79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!