2

I have a Raspberry Pi 3 board. I want to use it like an Arduino Uno board. My problem is very simple in that, I used 'Arduino' software to link with my Arduino Uno/Nano boards to blink LEDs. I have Windows 7 and Windows 10 on my desktop computers.

Please tell me which software I can use to program a Raspberry Pi 3 after connecting an LED, via Breadboard? Can I program it using Arduino software or something else on Windows?

3
  • 1
    You can program it in any language available in Linux - there are dozens. I suggest you start with a language you know.
    – Milliways
    Sep 17, 2019 at 4:17
  • Well, it depends on too many things. Let me tell you my story. I have 5 years hobbyist's experience in Arduino, from Decimilla to Uno, and 5 years in Rpi1 to Rpi4, 10 years Win7 to 10. I play IoT toys using GPIO, UART, SPI, I2C. My long term 10 year goal is Google AI home automation. After playing with Rpi, I decided to give up Arduino, only use Rpi4B and python, with Win10 support on general web browsing, program/text file editing, backup/storage. I think Rpi3/4 python 3.7.3 Thonny is a good start for you .Or let us know your short/long term goal, wild dreams, for brainstorming ideas..
    – tlfong01
    Sep 17, 2019 at 4:34
  • 1
    The question at the top doesn't seem to reflect the content of what you've asked. The answer to the top question is just "no", but you really want to know what you options are - Since you're currently programming C++ on Arduino, I'm guessing you're not going out of your way to care about Python specifically.
    – Brick
    Sep 17, 2019 at 16:47

4 Answers 4

2

While you can run Arduino code on RPI, given the power and extensibility of RPI you can use other languages you may be more familiar with (Python, Java, Perl, JavaScript, Erlang, Go, C#, C(++)) for whatever tasks you have. Most modern languages will give you libraries to deal with RPI specifics, such as manipulation of GPIO and whatnot.

1

You can control the Pi GPIO from a program written and running on your Windows machine.

Arguably the simplest and most supported way will be by using the gpiozero software. In particular see Remote GPIO Recipes.

gpiozero uses pigpio to control the GPIO from a remote machine. If you prefer you can use the pigpio Python module directly.

1

If you want to program the Pi through the Arduino IDE, this is possible with a little bit of configuration two ways. The first way is online using the Arduino Create cloud tool. Simply follow the getting started link. You'll have to program through the web browser. The second way is setting up a package called RasPiArduino. There is a comprehensive set of directions in that link, which boil down to two main phases which I'll outline in brief.

RasPiArduino step 1: Tell the Arduino IDE that Raspberry Pis exist. In the Arduino IDE hardware folder create a RaspberyPi folder and extract the contents of https://github.com/me-no-dev/RasPiArduino/archive/master.zip into a folder called piduino.

RasPiArduino step 2: Setup the RaspberryPi. Use sudo passwd and set a root password. Then edit /etc/ssh/sshd_config to premit root and password logins. Disable the serial console, I2C, and SPI using raspi-config and disable sound by running sed -i "s/dtparam=audio=on/#dtparam=audio=on/" /boot/config.txt. Run 'apt-get install telnet git' to install telnet and git. Setup the avahi service:

cat > /etc/avahi/services/arduino.service <<EOL
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_arduino._tcp</type>
    <port>22</port>
    <txt-record>board=bplus</txt-record>
  </service>
</service-group>
EOL

service avahi-daemon restart`

Install necessary binaries:

git clone https://github.com/me-no-dev/RasPiArduino.git piduino
chmod +x piduino/tools/arpi_bins/*
cp piduino/tools/arpi_bins/* /usr/local/bin
rm -rf piduino
ln -s /usr/local/bin/run-avrdude /usr/bin/run-avrdude

The last step should be to reboot.

0

Although I don't have personal experience with it, WiringPi claims to provide an API that is similar to the Ardunio API. That may be a good route to consider if you have existing Arduino code that you want to port as directly as possible.

http://wiringpi.com/

You should expect to need to make some changes when you port, but this may be a path of least resistance for you in your case.

1
  • Alas, I see now that WiringPi is no longer support as of last month, so that's something to consider too, if you're just staring your project. wiringpi.com/wiringpi-deprecated
    – Brick
    Sep 17, 2019 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.