Poll
Question: Learn aruidno language like c++ language?
What is the arduino language? - 3 (100%)
c#,c++,Perl, What is arduino's language? - 0 (0%)
Total Voters: 3

Pages: [1]   Go Down
Author Topic: c#,c++,Perl, What is arduino's language?  (Read 564 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Great minds have purposes, others have dreams
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Is there a book that shows how to program well and efficiently the arduino language like a c++ book?

Im learning c++, but what language is the arduino using? I cannot find any place that teaches how to learn the language in dept.

Please tell mehow the language works

Thank you
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Im learning c++
That's good, because that IS the language that the Arduinos are programmed in.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
Great minds have purposes, others have dreams
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then why isn't working when I try the simplest c++ program?
#include <iostream>
using namespace std;
int main()

{
 
  int x;
 
  cout<<"Please enter value";
  cin>>x;
 
 

return 0;
}
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It doesn't have a file system. There is no stdin and stdout.

Also the STL is not included. You can however download that (not that this gives you cout at such). However there *is* a streaming library. That lets you stream to the serial port.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Then why isn't working when I try the simplest c++ program?
Have you LOOKED at your Arduino? Where do you expect the data that cout outputs to appear? The Arduino doesn't have a display device?

Where do you expect the data that cin is looking for to come from? Did your Arduino come with a keyboard attached?

Logged

Southern California
Offline Offline
God Member
*****
Karma: 5
Posts: 539
I like blinky lights
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Then why isn't working when I try the simplest c++ program?
#include <iostream>
using namespace std;
int main()
.
.
.

The Arduino environment defines main() for you already, so you can't redefine it. It's in hardware \ arduino \ cores \ arduino \ main.cpp and it looks like this:

Code:
#include <Arduino.h>

int main(void)
{
init();

#if defined(USBCON)
USB.attach();
#endif

setup();
   
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
       
return 0;
}


Logged

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Pages: [1]   Go Up
Jump to: