After subconsciously try it on my debian machine about a week, now when I have a chance to write on arduino IDE on my Macbook, it wont upload the sketch, no port for nano.
installing FTDI driver didn't help because it use CH340G chip for com.
Grab the driver from http://www.wch.cn/downloads.php?name=pro&proid=178
install it
restart,
no change, :(
found out that we have to run this on terminal
sudo nvram boot-args="kext-dev-mode=1"
reboot,
yup, the life is easier again, :)
Monday, April 27, 2015
Thursday, April 23, 2015
Mengirim Perintah ke Arduino Nano via Bluetooth
Menggunakan HC-05
Arduino Nano
Menyalakan LED 13 (blink tanpa delay)
Menyalakan LED 3 dengan mode PWM dengan perintah analogRead, sehingga nyala LED berangsur-angsur dari redup ke terang ke redup lagi (255 tingkat kecerahan).
Menyalakan LED 2 dengan perintah melalui port serial bluetooth dari Mac OS X.
(program ditulis dan dijalankan di linux Debian)
led pin 3 dapat dinyalakan (setelah microcontroler tersambung dengan komputer via bluetooth) dengan mengetikkan 'nyala' atau 'mati' pada konsole di komputer.
#include <softwareserial .h>
.
Arduino Nano
Menyalakan LED 13 (blink tanpa delay)
Menyalakan LED 3 dengan mode PWM dengan perintah analogRead, sehingga nyala LED berangsur-angsur dari redup ke terang ke redup lagi (255 tingkat kecerahan).
Menyalakan LED 2 dengan perintah melalui port serial bluetooth dari Mac OS X.
(program ditulis dan dijalankan di linux Debian)
led pin 3 dapat dinyalakan (setelah microcontroler tersambung dengan komputer via bluetooth) dengan mengetikkan 'nyala' atau 'mati' pada konsole di komputer.
#include <softwareserial .h>
SoftwareSerial hc05(11,12); //RX TX
String baca;
int t=0;
int dt=1;
void setup() {
hc05.begin(9600);
hc05.println("Tadaa...");
pinMode(13, OUTPUT);
pinMode(2, OUTPUT);
}
void loop() {
t+=dt;
//hc05.print("nilai t = ");
//hc05.println(t);
while (hc05.available()){
char c = hc05.read();
baca += c;
}
if(baca.length()>0){
hc05.println(baca);
if (baca.indexOf("nyala")>=0){
digitalWrite(2,HIGH);
}
if (baca.indexOf("mati")>=0){
digitalWrite(2,LOW);
}
}
baca="";
if(t>=255){
dt=-1;
digitalWrite(13, LOW);
}
if(t<=0){
dt=1;
digitalWrite(13,HIGH);
}
analogWrite(3,t);
delay(27);
}
.
Friday, April 17, 2015
AngryBird-Like Velocity Changing Using ActionScript on Macromedia Flash 8
Velocity is set by dragging box. Process begin when the press on the box is released.
The 'Pig' animation is triggered whenever hitTest between 'kotak' and 'pigpig' returned true value
The 'Pig' animation is triggered whenever hitTest between 'kotak' and 'pigpig' returned true value
Wednesday, April 15, 2015
Fritzing, One Stop Apps for MicroController
We could write code in it, connecting parts on breadboard (or project-board), auto-route it to schematic and pcb layout (single or double layer).
It has several arduino board ready on parts section
It has several arduino board ready on parts section
Dengan Fritzing, kita bisa menulis kode mikrocontroler di sini, memasang komponen dan menyambung dengan kabel di project-board, kemudian me-route secara otomatis menjadi skematik seperti di EWB (Electronic Work Bench), routing otomahis juga dilakukan untuk menghasilkan layout PCB seperti di Protel (mendukung single dan double-layer)
Saturday, April 11, 2015
Blink Without Delay Problem on Arduino
Well, not for all, but for me it becomes problem while turning led on using analogWrite command, some led just won’t completely shut down.
(Maybe it completely unrelated, but my analog reading on A0 is oscillating, very unstable)
I have the commands packed on a function
Since I already have delay in loop, and it really messed with the timing (not mention that maybe the analog reading instability have anything to do with it), I decided to modify the blink code, still without delay command.
(Maybe it completely unrelated, but my analog reading on A0 is oscillating, very unstable)
I have the commands packed on a function
unsigned long t0 = 0;
const long dt = 1000;
void blinkNoD(int pin) {
unsigned long t = millis();
if(t - t0 >= dt) {
t0 = t;
led=!led;
digitalWrite(pin, led);
}
}
Since I already have delay in loop, and it really messed with the timing (not mention that maybe the analog reading instability have anything to do with it), I decided to modify the blink code, still without delay command.
unsigned long t0 = 0;It turned out that my analogRead instability is another problem, get to work on it, :)
const long dt = 1;
void blinkNoD(int pin) {
t0 += dt
if(t0 >= 4) {
t0 = 0;
led=!led;
digitalWrite(pin, led);
}
}
Friday, April 10, 2015
Thursday, April 9, 2015
Sensor Analog di Arduino, dengan monitor via bluetooth
KProgram ini digunakan untuk melihat nilai sensor (berupa tegangan) di port analog 0 (A0) di ATMega328.
Di sini sensor diwakili oleh potensiometer yang kaki tepinya masing-masing dihubungkan ke vcc dan ground, kaki tengah dihubungkan ke port analog 0.
Microcontroler membaca port analog 0 yang nilainya kemudian dikirimkan secara serial via bluetooth, juga untuk menyalakan empat led sesuai dengan nilai pembacaan sensor.
Karena ATMega328 memliliki resolusi pembacaan analog sebesar 10-bit, maka led diset sedemikian sehingga led 1 menyala jika nilai kurang dari 255, led 1 dan 2 menyala jika nilai sensor antara 255 dan 512, dst.
Sebagai tambahan, perintah yang digunakan untuk menyalakan led adalah analogWrite() bukan digitalWrite() sehingga meski nilai sensor kurang dari 255, kita masih bisa membedakan levelnya dengan tingkat redup-terangnya led pertama (0 mati, 50 redup, 255 nyala terang).
I also use it to blink led without delay, fade without delay, write to serial via Bluetooth module (HC-05) AND USB-to-TTL.
Notice that I have two TX and two RX, the default pin (0 and 1) for usb communication (upload sketch and debugging), the software serial TX,RX (pin 8 and 7) is used for bluetooth communication.
Here the code. I use some function to isolate some group of commands for easy debugging.
#include <softwareserial .h>
Di sini sensor diwakili oleh potensiometer yang kaki tepinya masing-masing dihubungkan ke vcc dan ground, kaki tengah dihubungkan ke port analog 0.
Microcontroler membaca port analog 0 yang nilainya kemudian dikirimkan secara serial via bluetooth, juga untuk menyalakan empat led sesuai dengan nilai pembacaan sensor.
Karena ATMega328 memliliki resolusi pembacaan analog sebesar 10-bit, maka led diset sedemikian sehingga led 1 menyala jika nilai kurang dari 255, led 1 dan 2 menyala jika nilai sensor antara 255 dan 512, dst.
Sebagai tambahan, perintah yang digunakan untuk menyalakan led adalah analogWrite() bukan digitalWrite() sehingga meski nilai sensor kurang dari 255, kita masih bisa membedakan levelnya dengan tingkat redup-terangnya led pertama (0 mati, 50 redup, 255 nyala terang).
I also use it to blink led without delay, fade without delay, write to serial via Bluetooth module (HC-05) AND USB-to-TTL.
Notice that I have two TX and two RX, the default pin (0 and 1) for usb communication (upload sketch and debugging), the software serial TX,RX (pin 8 and 7) is used for bluetooth communication.
Here the code. I use some function to isolate some group of commands for easy debugging.
#include <softwareserial .h>
SoftwareSerial mySerial(8, 7); // RX, TX.
int led = LOW;
int dterang = 5;
int terang = 11;
unsigned long t0 = 0;
const long dt = 1000;
void setup() {
setupSerial();
pinMode(13, OUTPUT);
}
void loop() {
fadeLed(5);
blinkNoD(13);
adcToLed(0);
bacaAnalog(0);
delay(100);
}
void adcToLed(int pin){//3,9,10,11
int nilai = analogRead(pin);
int sisa = nilai % 256;
if (nilai<256 data-blogger-escaped--1="" data-blogger-escaped-512="" data-blogger-escaped-768="" data-blogger-escaped-analogwrite="" data-blogger-escaped-dterang="" data-blogger-escaped-else="" data-blogger-escaped-fadeled="" data-blogger-escaped-if="" data-blogger-escaped-int="" data-blogger-escaped-nilai="" data-blogger-escaped-pin="" data-blogger-escaped-sisa="" data-blogger-escaped-terang="" data-blogger-escaped-void="">=255 ){
terang = 255;
dterang *= -1;
}
analogWrite(pin, terang);
}
void blinkNoD(int pin) {
unsigned long t = millis();
if(t - t0 >= dt) {
t0 = t;
led=!led;
digitalWrite(pin, led);
}
}
void bacaAnalog(int pin) {
int sensor = analogRead(pin);
mySerial.print("Pin ");
mySerial.print(pin);
mySerial.print(" bernilai ");
mySerial.println(sensor);
Serial.println("Output dilewatkan port serial via bluetooth");
delay(10);
}
void setupSerial(){
Serial.begin(9600);
Serial.println("Hello, world? Ini kabel");
mySerial.begin(9600);
mySerial.println("Hello, world? Ini bluetooth");
}
/*
PWM: 3, 5, 6, 9, 10, and 11.
PI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK)
Serial: 0 (RX) and 1 (TX)
*/
Subscribe to:
Posts (Atom)
My sky is high, blue, bright and silent.
Nugroho's (almost like junk) blog
By: Nugroho Adi Pramono
323f
(5)
amp
(1)
android
(12)
apple
(7)
arduino
(18)
art
(1)
assembler
(21)
astina
(4)
ATTiny
(23)
blackberry
(4)
camera
(3)
canon
(2)
cerita
(2)
computer
(106)
crazyness
(11)
debian
(1)
delphi
(39)
diary
(286)
flash
(8)
fortran
(6)
freebsd
(6)
google apps script
(8)
guitar
(2)
HTML5
(10)
IFTTT
(7)
Instagram
(7)
internet
(12)
iOS
(5)
iPad
(6)
iPhone
(5)
java
(1)
javascript
(1)
keynote
(2)
LaTeX
(6)
lazarus
(1)
linux
(29)
lion
(15)
mac
(28)
macbook air
(8)
macbook pro
(3)
macOS
(1)
Math
(3)
mathematica
(1)
maverick
(6)
mazda
(4)
microcontroler
(35)
mountain lion
(2)
music
(37)
netbook
(1)
nugnux
(6)
os x
(36)
php
(1)
Physicist
(29)
Picture
(3)
programming
(189)
Python
(109)
S2
(13)
software
(7)
Soliloquy
(125)
Ubuntu
(5)
unix
(4)
Video
(8)
wayang
(3)
yosemite
(3)