Arduino and C++? | Sololearn: Learn to code for FREE!

+1

Arduino and C++?

I am trying to put my C++ knowledge into some practical and helpful use. Is it proper to use C++ in arduino? or how do I do it?

2/24/2018 5:45:11 AM

何岱庭

13 Answers

New Answer

+15

@ seamiki, thanks a lot, i am open for news and very interested for this topic, but i also have to learn a lot in this direction 👍😉

+12

i am sorry, my fault, i mixed up raspbery with arduino 😔😔 the advise of Oma Falk was: if you want to work with c++, you should use mbed 👍😉 https://www.mbed.com/en/

+12

@ seamiki, very interesting informations, thanks a lot but tutorials point offers an arduino course in c and c++ https://www.tutorialspoint.com/index.htm

+12

@ Martin Taylor, thank you for the information and the link 👍😉

+4

i find this tutorial quite good if you want to use pure c. https://youtu.be/QgFgfaw7C7U

+3

As the title says: "interfacing" that is an example of how to establish a serial communication between your arduino and a java program running on your pc. basically you program the Arduino (in a c/c++ way) to send repeatedly "Hello World" on the serial port and your Java program (mentioned in the tutorial you linked) on your computer will read it. it can be easily done using Processing. Forget about programming your arduino with java: it cannot be done because you do not have enough resources on an ATMega 328 to run a JVM.

+2

@tooselfish I don't think Oma Falk advises java for Arduino as it would not be feasible. this is a good example/tutorial of a useful way to implement c++ OOP with arduino. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview

+2

@tim My advice is just load some examples and tweak them. You won't need too much c++ knowledge for basic things. of course the more you'll learn, the more you can implement. the link i provided in the above post uses OOP as a work aroud to the use of delays (that you'll start to hate soon as they freeze your microcontroller).

+2

K have some idea now. Might come back for more help later. Thx

+1

@tooselfish also the SO link you added provides solutions for interfacing: you program the arduino in c/c++ to "react" to certain serial commands. then you write a program in java (or c++ or python, or ruby or a batch script or a shell script or whatever you want, that runs on a computer to send that command through the serial port at the same baud rate as the Arduino. Firmata protocol is a nice implementation of this type of interface. Have a look at the firmata firmware.

+1

Trying to catch up....

+1

@tooselfish quoted from the book descriptiin about java and arduino you linked: Description This book was written to help anyone want to get started with Arduino and Java. It describes the basic elements of the integration of Arduino and Java using serial port.  unquote reading my previous posts you'll see that also this, is a case of interfacing a java program running on a pc with an arduino programmed using c/c++.