Basic Python in / output

Discussion in 'Android' started by objectr, Jul 6, 2014.

  1. objectr

    objectr Member

    Joined:
    May 28, 2014
    Messages:
    36
    Likes Received:
    1
    Im interested in writing a python program that reads a value over the Analog input pin and displays that value on screen and also outputs a mapped value of that to the Digital Output (PWM) pin.
    How can these pins be accessed through python?

    thank you so much
     
  2. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Use firmara / pyfirmara to collect the analogue values and control the pwm pin , and use python for the high level logic and programming .
     
  3. objectr

    objectr Member

    Joined:
    May 28, 2014
    Messages:
    36
    Likes Received:
    1
    thanks peter! do you have any examples or websites you can recommend?
     
  4. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    The big advantage of firmata is its universal , so any web site about firmata for the raspberry pi , beaglebone etc will work on the udoo because you are just controlling the arduino.

    Search for firmata and you will come up with many examples and the document how to use it with python .

    http://www.abluestar.com/blog/raspberry ... -protocol/

    after you have set it up you will find you need to make a config file to tell firmata what port you have on the board because by default firmata only supports mega or the old standard arduino , Which I`ve made is the want it .
     
  5. objectr

    objectr Member

    Joined:
    May 28, 2014
    Messages:
    36
    Likes Received:
    1
  6. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    The best way is to use the arduino for control , because of it`s advantage of better current handling of the pins plus the imx6 side doesn`t have any adc built in so you how to use the arduino side for adc .

    NO , the raspberry pi gpio library will only work on machine using the same hardware chip , you would need a library for the imx6 .
    The basic way to control them should be the same or similar , because it`s kernel level.
     
  7. objectr

    objectr Member

    Joined:
    May 28, 2014
    Messages:
    36
    Likes Received:
    1
    thank you! but how can i install pyfirmata on android?
     
  8. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Have a search for :- "firmata android" and there are some programs which controls a arduino using firmata for android , but to do honest I have no idea how to install python or even if it is installed by default on android .
     

Share This Page