Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:show_examples [2015/04/21 16:28] john1117 [Bash example] |
en:show_examples [2015/04/21 16:28] (current) john1117 [Basic tutorial] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== ODROID-SHOW examples ====== | ||
+ | Download ODROID-SHOW source code first.\\ | ||
+ | Then connect microUSB cable to the Host PC with ODROID-SHOW.\\ | ||
+ | Finally check the serial port number and run bash shell script file. | ||
+ | |||
+ | <WRAP center round important 100%> | ||
+ | ** The DTR reset jumper should not be connected to ODROID-SHOW Except in case of writing a firmware. ** | ||
+ | </WRAP> | ||
+ | {{http://dn.odroid.com/homebackup/show2_boarddetail.jpg}} | ||
+ | ===== Download ODROID-SHOW source code ===== | ||
+ | sudo apt-get install git | ||
+ | git clone https://github.com/hardkernel/ODROID-SHOW | ||
+ | |||
+ | |||
+ | ===== C example ===== | ||
+ | |||
+ | ==== Basic tutorial ==== | ||
+ | <WRAP center round important 100%> | ||
+ | ** This tutorial is compatible firmware version 2.0 so if it isn't 2.0, update your firmware on ODROID-SHOW ** | ||
+ | </WRAP> | ||
+ | <code c> | ||
+ | ... | ||
+ | int serialSetup(void) | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | void writeData(int fd, char *str) | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) | ||
+ | { | ||
+ | ... | ||
+ | | ||
+ | writeData(usbdev, "Hello ODROID-SHOW"); | ||
+ | | ||
+ | return 0; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== Show your ODROID's Stats ==== | ||
+ | This linux c source code show the ODROID’s stats and clock. | ||
+ | |||
+ | Check your serial port. | ||
+ | ls /dev/ttyUSB* | ||
+ | To run this program, you need to compile. | ||
+ | gcc -o status status.c | ||
+ | sudo ./status | ||
+ | | ||
+ | {{:en:procstat.jpg?400|}} | ||
+ | ===== Bash example ===== | ||
+ | This bash script can display 2 text strings with different color and different font size.\\ | ||
+ | Open the “/dev/ttyUSBn” port and sending VT100/ANSI commands with a couple of strings.\\ | ||
+ | It also changes the color of strings. | ||
+ | |||
+ | ==== Basic tutorial ==== | ||
+ | <WRAP center round important 100%> | ||
+ | ** This tutorial is compatible firmware version 2.0 so if it isn't 2.0, update your firmware on ODROID-SHOW ** | ||
+ | </WRAP> | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | ... | ||
+ | function programExit() | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | writeData() | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | writeData "\ec" | ||
+ | writeData "Hello ODROID-SHOW" | ||
+ | |||
+ | ... | ||
+ | </code> | ||
+ | ==== Text output ==== | ||
+ | check your serial port | ||
+ | ls /dev/ttyUSB* | ||
+ | Modify the serial port path "/dev/ttyUSB0" or "/dev/ttyUSBn" | ||
+ | cd ODROID-SHOW/example/linux | ||
+ | vi ODROID.sh | ||
+ | Run | ||
+ | sudo ./ODROID.sh | ||
+ | {{:en:odroid.sh.jpg?300|}} | ||
+ | |||
+ | ==== Image display ==== | ||
+ | You can display a graphic image on the ODROID-SHOW.\\ | ||
+ | It supports only raw RGB-565 format. | ||
+ | |||
+ | We used ffmpeg to convert a normal PNG file to raw RGB file. Note that you must resize the PNG file first. | ||
+ | <code> | ||
+ | sudo apt-get install ffmpeg | ||
+ | </code> | ||
+ | |||
+ | You can convert it with this command. If the conversion is success, you will have the penguin.raw file. | ||
+ | <code> | ||
+ | ffmpeg -vcodec png -i penguin.png -vcodec rawvideo -f rawvideo -pix_fmt rgb565 penguin.raw | ||
+ | </code> | ||
+ | You can set the image load mode with the pixel coordination parameters. | ||
+ | |||
+ | Check your serial port | ||
+ | ls /dev/ttyUSB* | ||
+ | Modify the serial port "/dev/ttyUSB0" or "/dev/ttyUSBn" | ||
+ | cd ODROID-SHOW/example/linux | ||
+ | vi images.sh | ||
+ | Run | ||
+ | sudo ./images.sh | ||
+ | |||
+ | {{:en:penguin.jpg?300|}} | ||