Difference between revisions of "Arduino: Cek sambungan USB ke laptop"

From OnnoWiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 70: Line 70:
 
* Read Analog
 
* Read Analog
 
* Read Digital
 
* Read Digital
 +
 +
 +
 +
==Menggunakan cu==
 +
Instalasi
 +
 +
sudo apt-get install cu
 +
 +
Komunikasi
 +
 +
cu -l /dev/<device> -s <speed>
 +
cu -l /dev/ttyACM0 -s 115200
 +
 +
Apa saja yang di ketik di layar akan langsung dikirim
 +
Apa saja yang di terima akan langsung di tampilkan
 +
 +
 +
==cek Status USB==
 +
 +
stty -a < /dev/ttyACM0
 +
 +
Harusnya keluar, misalnya,
 +
 +
speed 115200 baud; rows 0; columns 0; line = 0;
 +
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
 +
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 1;
 +
-parenb -parodd cs8 hupcl -cstopb cread -clocal crtscts
 +
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
 +
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
 +
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke
 +
 +
 +
Set serial agar sesuai
 +
 +
stty -F /dev/ttyACM0 115200 -parenb -parodd cs8 hupcl \
 +
-cstopb cread -clocal crtscts -ignbrk -brkint -ignpar \
 +
-parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff \
 +
-iuclc -ixany -imaxbel -iutf8 -opost -olcuc -ocrnl -onlcr \
 +
-onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 \
 +
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh \
 +
-xcase -tostop -echoprt -echoctl -echoke
  
 
==Referensi==
 
==Referensi==
  
 
* http://playground.arduino.cc/Interfacing/LinuxTTY
 
* http://playground.arduino.cc/Interfacing/LinuxTTY

Latest revision as of 14:54, 16 November 2015

Untuk mengetahui apakah Arduino yang kita miliki tersambung dengan baik dengan USB di laptop

  • Sambungkan Power Supply ke Arduino
  • Pastikan lampu "ON" nyala
  • Sambungkan USB ke laptop

Di laptop ketik

lsusb

Akan keluar, salah satunya

Bus 003 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)

Berarti Arduino terdeteksi

Mengajak Arduino Bicara melalui TTY

Konfigurasi USB

stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts 

Konfigurasi /dev/ttyACM0

stty -F /dev/ttyACM0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts 

Bicara dengan Arduino

echo "Hello Arduino" > /dev/ttyACM0

Membaca informasi dari Arduino

tail -f /dev/ttyACM0

Cek buffering di Arduino

echo -n "Hello" > /dev/ttyACM0


Menggunakan screen

Install

apt-get install screen

Set baud rate

stty -F /dev/ttyACM0 cs8 9600 ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

Masuk ke screen

screen /dev/ttyACM0 9600 

Lakukan

  • Press Enter
  • Kirim
w d 13 1
r a
r d


Yang akan dilakukan Arduino

  • Write Digital pin 13 nilai 1
  • Read Analog
  • Read Digital


Menggunakan cu

Instalasi

sudo apt-get install cu

Komunikasi

cu -l /dev/<device> -s <speed>
cu -l /dev/ttyACM0 -s 115200

Apa saja yang di ketik di layar akan langsung dikirim Apa saja yang di terima akan langsung di tampilkan


cek Status USB

stty -a < /dev/ttyACM0

Harusnya keluar, misalnya,

speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 1;
-parenb -parodd cs8 hupcl -cstopb cread -clocal crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke


Set serial agar sesuai

stty -F /dev/ttyACM0 115200 -parenb -parodd cs8 hupcl \
-cstopb cread -clocal crtscts -ignbrk -brkint -ignpar \
-parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff \
-iuclc -ixany -imaxbel -iutf8 -opost -olcuc -ocrnl -onlcr \
-onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 \
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh \
-xcase -tostop -echoprt -echoctl -echoke

Referensi