Go Down

Topic: [Python][Exode] Write Python scripts and take control of your Arduino board. (Read 1 time) previous topic - next topic

sn33ks

Apr 22, 2016, 12:01 pm Last Edit: Sep 16, 2016, 07:27 pm by sn33ks Reason: new version
Hello !

I proudly present my last Python project "Exode".
https://github.com/sne3ks/Exode

Exode is a library for communication between Arduino microcontroller boards and a connected computer.
It's designed to be really simple to use, here an example :

Code: [Select]

from Exode import *
uno = Board('/dev/tty.usb-3')

led = Led(13)
led.blink(500)                        





Once your Arduino connected to your device (computer, Rasberry Pi, smartphone ..) using a serial IO (usb/bluetooth), you're now allowed to have remote interactions with your board. And then :

  • You're not constrain to compile your source after each modifications
  • You can let your computer process the most complex tasks


The others advanges of this library are :

The Graphic User interface :


Easy to code

Code: [Select]

from Exode     import *
from Exode.UI  import *

uno= Board('/dev/cu.wchusbserial1410')
led= Led(13)

switchBox= ExdSwitchBox(target=led, value="lvl")
radioBox = ExdRadioBox(target=led, title="Led13", value="lvl")

APP.STACK.add_widget(switchBox)
APP.STACK.add_widget(radioBox)                       


Event-driven programming and Multithreading ...
You will found more informations here https://github.com/sne3ks/Exode

I hope you'll enjoy  ;)


sn33ks

Hi everybody !

Some new about the project. UI interface is now available :)



With others functionalities :
- Steppers
- Timer1 Thread
- and other modifications inside the lib's core

Source code is here and references here . Give me your feed-back !!


spcrngr

Interesting work, and thanks for sharing it with the world. It's nice to see it's documented, too!

I released a similar communication library (from C#) just today - ArduinoLibCSharp so it's quite interesting to see the differences in overall approach and design decisions.

Could you elaborate on the reason for "protothreading" the core? Is it just for scheduling purposes e.g. for PeriodicSwitch?

One possible improvement would be to allow the serial protocol to operate at a speed higher than 9600 bps (since e.g. it reduces the number of readings you can achieve per second in tight loops).

I found that in order to bump the speed, the serial protocol must really be designed with synchronization and error detection in mind (since loss does definitely occur at higher speeds).



sn33ks

Thank for your interest in my project,

I have looked your project on github and I really appreciate the possibility to upload the C# code directly on the board.

To answer your actual question about prothreading, yes is mainly for scheduling purposes. I use this to read my inputs periodically (event-driven programming). At the beginning of my project, the "arduinoListener" was very similar to yours, with a big switch case on the loop. Due to the scheduling on the board, I reduce the necessary to use the serial connection, too.

About the serial speed, today I don't really need a speed higher than 9600 bps, 9600bps it's a good compromise. It's also stable.
Also, at my beginning I was using an error detection, I removed it because USB provides error detection and retry natively.

spcrngr

I have looked your project on github and I really appreciate the possibility to upload the C# code directly on the board.
That would be super awesome (upload C# code to be transformed and executed directly on the board) but that's not what  the uploader in my project does. The uploader (which itself is pure C#) is able to upload a compiled hex file directly on the board (e.g. much like avrdude, but without simply wrapping avrdude - like many other uploaders do).

About the serial speed, today I don't really need a speed higher than 9600 bps, 9600bps it's a good compromise. It's also stable. Also, at my beginning I was using an error detection, I removed it because USB provides error detection and retry natively.
USB provides error detection and retry natively but that's only for the connection between the USB chip and the PC. You can still have packet loss etc. on the connection to the Arduino (typically when operating at higher speeds) so some system of framing / synchronization and error detection is still required for higher baud rates (in my experience).

sn33ks

USB provides error detection and retry natively but that's only for the connection between the USB chip and the PC. You can still have packet loss etc. on the connection to the Arduino (typically when operating at higher speeds) so some system of framing / synchronization and error detection is still required for higher baud rates (in my experience).
Ok ! thanks for it, I never met these problems because I always use a 9600bps baud rate :) I may well need to integrate error detection/ synchronization if i use a higher baud rate.

sn33ks

Up ! Exode 1.0.5 is now available and downloadable with the Arduino Library Manager.
Installation guide here : https://github.com/sne3ks/Exode/wiki/Installation-guide

oneindelijk

Hi,

Very interesting project !
I was wondering if I could use a rotary encoder through these libraries and how to implement this ?

Regards

Go Up