(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
and continue your work there. Thank you.

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 04 Dec 2020, 07:06
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Arduino programing in Fatdog64
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message

Joined: 29 Jan 2008
Posts: 129

PostPosted: Sun 05 Mar 2017, 14:04    Post subject:  Arduino programing in Fatdog64
Subject description: platformio and arduino uno

This is how I got my first arduino program up and running from fatdog64. I suppose the procedure should work on all resent puppy derivatives with a little tinkering.

Forget about the fancy IDE approach. To me it was a dead end because of dependencies. And we all love Geany, vim and the terminal anyway, don't we..Surprised)

The tool we need is platformio core
SOURCE: http://platformio.org/get-started/cli
First you need to load your devx. On Fatdog64 you can load it with
load_sfs.sh --load <path>/*devx*.sfs

I can't remember if any other puppy has load_sfs.sh but normally you can load and unload a devx from ROX.

Then we need pip ( https://en.wikipedia.org/wiki/Pip_%28package_manager%29 )
wget -qO- https://bootstrap.pypa.io/get-pip.py | python

Then we need to update setuptools
pip install setuptools

And then we get platformio
pip install -U platformio

To make platformio happy (it worked without, but) we get som udev rules
cd /etc/udev/rules.d/
wget https://github.com/platformio/platformio-core/blob/develop/scripts/99-platformio-udev.rules

Now lets do a test.
command -v platformio

If it returns platformio the program is found and is executable.

Get a list of supported boards
platformio boards

Lets see if our board are found automatically

platformio device list

On my system the command returned:
Hardware ID: USB VID:PID=1A86:7523 LOCATION=1-8.4
Description: USB2.0-Serial

Make a simple project
mkdir /tmp/test_project
cd /tmp/test_project
platformio init --board uno

Make the obligatory hello world blink application
geany src/main.c

And use something like

 * Blink
 * Turns the L LED on and off
#include "Arduino.h"

#define LED_BUILTIN 13

void setup()
  // initialize LED digital pin as an output.

void loop()
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);

  // wait for a second

  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);

   // wait for a second

Test the project

platformio run

If we have success upload the code
platformio run -t upload

I think that is basically it.. As I use to do I wrapt it up in an sfs and that one came in at 6.5M. That is quite a lot less than the IDE alternatives out there.

As arduino is unfamiliar terrain to me I found the following resources handy:

Happy coding
Back to top
View user's profile Send private message 

Joined: 29 Jan 2008
Posts: 129

PostPosted: Mon 06 Mar 2017, 10:07    Post subject:  arduino programing on puppy
Subject description: Get the SerialCommand example to work.

Taking a shot at the SerialCommand example I did stumble on a few hurdles to get it started. So a short writeup.

First get the code.
// Demo Code for SerialCommand Library
// Steven Cogswell
// May 2011

#include <SerialCommand.h>

#define arduinoLED 13   // Arduino LED on board

SerialCommand sCmd;     // The demo SerialCommand object

void setup() {
  pinMode(arduinoLED, OUTPUT);      // Configure the onboard LED for output
  digitalWrite(arduinoLED, LOW);    // default to LED off


  // Setup callbacks for SerialCommand commands
  sCmd.addCommand("ON",    LED_on);          // Turns LED on
  sCmd.addCommand("OFF",   LED_off);         // Turns LED off
  sCmd.addCommand("HELLO", sayHello);        // Echos the string argument back
  sCmd.addCommand("P",     processCommand);  // Converts two arguments to integers and echos them back
  sCmd.setDefaultHandler(unrecognized);      // Handler for command that isn't matched  (says "What?")

void loop() {
  sCmd.readSerial();     // We don't do much, just process serial commands

void LED_on() {
  Serial.println("LED on");
  digitalWrite(arduinoLED, HIGH);

void LED_off() {
  Serial.println("LED off");
  digitalWrite(arduinoLED, LOW);

void sayHello() {
  char *arg;
  arg = sCmd.next();    // Get the next argument from the SerialCommand object buffer
  if (arg != NULL) {    // As long as it existed, take it
    Serial.print("Hello ");
  else {
    Serial.println("Hello, whoever you are");

void processCommand() {
  int aNumber;
  char *arg;

  Serial.println("We're in processCommand");
  arg = sCmd.next();
  if (arg != NULL) {
    aNumber = atoi(arg);    // Converts a char string to an integer
    Serial.print("First argument was: ");
  else {
    Serial.println("No arguments");

  arg = sCmd.next();
  if (arg != NULL) {
    aNumber = atol(arg);
    Serial.print("Second argument was: ");
  else {
    Serial.println("No second argument");

// This gets set as the default handler, and gets called when no other command matches.
void unrecognized(const char *command) {

I just copied it off the source and saved it in the same main.c file as I used for the blinky sample. If you do to and try to do a
platformio run
you will probably end up with a lot off errors as I did.

First I thought the library SerialCommand was missing. So digging around a bit with
platformio lib --help
platformio lib search
But it did not help. Then I came across some documentation indicating that I should add the library to the project file. That is in platformio.ini. So I did.
lib_deps = SerialCommand
Do a search for lib_deps as there are several ways to specify a library (by number, version and so on).

At this point a
platformio run
made platformio download and compile the SerialCommand library if I recall right. But Still I got a lot of errors. As the seasoned c/cpp programmer would expect the file extension is wrong. But changing it to cpp did not entierly fix it either.

Turns out there is another extension to be used in this domain. ino.
mv src/main.c src/main.ino
did the trick.

So uploading it to the uno also worked. But if you have read the code the point of it is that you may send commands from your computer to your device and receive results. How do we set this up in a simple manner?

A terminal whit screen running is the ansver. A better soulution further down!
Open a terminal window and issue the command:
screen /dev/ttyUSB0 9600

ttyUSB0 is where the code is uploaded to and 9600 is the baud-rate set in the code.

Now we split the window with
ctrl+a S. Move to the new split with Ctrl+a taband create a new terminal with Ctrl+a c

At this point we can send commands to our device in the last terminal we created. So try it out. First hit the reset button on your board. Then:
echo -e ON > /dev/ttyUSB0
echo -e ON > /dev/ttyUSB0
echo -e OFF > /dev/ttyUSB0
echo -e HELLO > /dev/ttyUSB0
echo -e P 12 6 > /dev/ttyUSB0

I got this result back in the first screen window

LED on
LED off
Hello, whoever you are
We're in processCommand
First argument was: 12
Second argument was: 6

Now, this is way more fun than I thought it would be. So Now I have to get a Bluetooth breakout card for my UNO.

EDIT: Rather than using screen to monitor and a terminal to send it is better to use the incredible handy command:
platformio device monitor

Happy coding
Uten Very Happy

Last edited by Uten on Wed 15 Mar 2017, 18:56; edited 1 time in total
Back to top
View user's profile Send private message 

Joined: 29 Jan 2008
Posts: 129

PostPosted: Tue 07 Mar 2017, 09:12    Post subject: Arduino programming in Fatdog64
Subject description: A collection of links

This is just a collection of links to places I have found interesting or handy: This post will be edited from time to time.

The obligatory places
It is kind of obvious: https://www.arduino.cc/
The platformio tools: http://platformio.org/
Another framework: http://wiring.org.co/

Other sources
Some really good articles here: http://gammon.com.au/forum/bbshowpost.php?bbtopic_id=123
Ladyada, adafuit tutorials: https://learn.adafruit.com/series/learn-arduino
Multitasking ( a must read if your serious): https://learn.adafruit.com/multi-tasking-the-arduino-part-3
Some nice articles: https://folk.uio.no/jeanra/Microelectronics/

Forums and information:

A atmel avr simulator: http://www.nongnu.org/simulavr/
Front end gui tool: https://mydevices.com/cayenne/landing/arduino/

EasySheduler, Not sure it's the right tool but I got it going: http://blog.protoneer.co.nz/arduino-task-scheduler/

Shopping parts
Aliexpress.com. By directly from China. Works better for me in Norway than buying from the states.Just search for what you need.
https://www.aliexpress.com/w/full retail plus shipping-microcontroller.html
https://www.aliexpress.com/w/full retail plus shipping-arduino.html
Have not tried them, but they have some interesting boards: http://sensorembedded.com
Adafruit is obvious to some: https://www.adafruit.com/
From UK: https://shop.pimoroni.com/
Back to top
View user's profile Send private message 

Joined: 29 Jan 2008
Posts: 129

PostPosted: Mon 05 Feb 2018, 07:06    Post subject:  

I have made a communication sample with a gtkdialog gui. The code are found in this thread
Back to top
View user's profile Send private message 

Joined: 20 Jan 2008
Posts: 973
Location: Asturias_ España

PostPosted: Sun 04 Mar 2018, 09:59    Post subject: arduino  

for 32 bits working in slacko 5.6.


see you
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.4094s ][ Queries: 11 (0.3286s) ][ GZIP on ]