Results 1 to 2 of 2
  1. #1
    nicocannon is offline Member
    Join Date
    Dec 2014
    Posts
    30
    Rep Power
    0

    Question Raspberry Pi help

    I dont know if this is the right section to be posting this but I really need help. I have a raspberry pi, some dc motors and some L293D motor drivers. I want to build an RC car with the pi and have java run the whole thing. I was originally going to do it in python but I dont like using python now. I need help on where I should start with this project I have my pi running java but I dont know where to go from there. I dont know how to use the GPIO pins and I cant find any good places to learn how to. Any help would be appreciated.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Raspberry Pi help

    Does your Pi run a version of Linux? If so, you can reach the gpio pins through the pseudo files /sys/class/gpio# where # is the number of a gpio pin. e.g. putting a pulse on, say, gpio pin #42 can be done as follows:

    Java Code:
    echo 42 > /sys/class/gpio/export
    echo "high" > /sys/class/gpio/gpio42/direction
    echo 1 > /sys/class/gpio/gpio42/value
    echo 0 > /sys/class/gpio/gpio42/value
    echo 42 > /sys/class/gpio/unexport
    Note that the above is a script 'language' thingie, but it can all be done with Java, because the above code only deals with files and Java can do that too; under the hood Linux takes care of the gory details.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •