Thursday 22 October 2015

PROGRAMMING AND UPLOADING ARDUINO SKETCH WITHOUT IDE

Arduino-mk package makes it simple to build and upload sketches on a Raspberry Pi without the bloated Arduino IDE.
Install the package:

sudo apt-get install arduino-mk
This will install all the required software and files.
Create a library area in your user home directory with a demo sketch in it:
mkdir ~/sketchbook
cd ~/sketchbook
ln -s /usr/share/arduino/Arduino.mk
mkdir blink
cd blink
sudo nano blink.ino

// Blink

void setup(void) {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, LOW);
  delay(1000);
  digitalWrite(13, HIGH);
  delay(1000);
}
Save it.
Create the Makefile:
sudo nano Makefile
# board tag is very import put your board name and model no
BOARD_TAG = mega2560 
ARDUINO_PORT = /dev/ttyACM0
ARDUINO_DIR = /usr/share/arduino
include /usr/share/arduino/Arduino.mk
make
make upload
It will prepare the c and bit files and burn the memory on your Arduino. Watch your LED blinks.
Other commands to perform various tasks:
make – no upload
make upload – compile and upload
make clean – remove all our dependencies
make depends – update dependencies
make reset – reset the Arduino by tickling DTR on the serial port
make raw_upload – upload without first resetting
make show_boards – list all the boards defined in boards.txt (11431)

No comments:

Post a Comment