Integrate arduino.ino file

Hello

I'm programming a sktech/application with arduino IDE. It's for my enclosure and for printing ABS. It mesures the temperature and with a potentiometer I can set the desired temperature on a display. If the temperatures is too low a relay turns on a fan which blows hot air inside the enclosure. As for now I planned this with an Arduino UNO.
But I was wondering if its possible to integrate such a sketch to the raspberry on octoprint somehow?

Thx for any help

To the best of my knowledge, the default language for Arduino devices is like a miny version of the C programming language. The IDE allows you to create these programs. The usual destination is to an Arduino device.

You could, though, create a C-based program in this IDE. You could then transfer it to the Raspberry Pi that's running OctoPrint, compile it and run it there. Some of the assumptions in the Arduino IDE might be wrong, though. It's usual in that IDE to select the hardware you had in mind. The Raspberry is an ARM-based processor. It may or may not be the same as that of the typical Arduino device. Also, the library modules that you might find for the Arduino for your sensors may not be the correct ones for the Pi.

But you could create a C-based source code file on the Pi and then run a command-based compiler/linker to create an executable from it.

The Arduino does accept analogy inputs and I'm guessing that this might be where your code might talk to it. The Pi—unless someone corrects me—does not have analog inputs out of the box. But here is an Adafruit tutorial which describes how you might add a chip to allow this.

2 Likes

Thank you for your detailed answer and insight. I guess I'll stay with the arduino then.

Becoming an Arduino developer I couldn’t help but be underwhelmed with the Arduino IDE. I remember wondering what the content assist key combination was just to find out, it doesn’t have content assist. What? That was one of the first features we added to CDT once we had the C++ parser in place LINKREDACTED

The Raspberry Pi can be used for real-time hardware control using the 40 pin GPIO connections. There are numerous libraries and hardware boards available. Adafruit is a good place to visit. In addition to C, libraries are available for Python and other languages as well.

That said, there's nothing wrong with the Arduino family for hardware control projects like this one. You can even find examples of how to communicate between your Arduino and your Raspberry Pi.

And honestly, I have combination projects where I have both a Pi and an Arduino board of some kind in tandem. I just use serial-over-GPIO to connect them together; I then have a full operating system on the Pi side and I have the toys in the Arduino space, too.