Post topics, source code that relate to the Arduino Platform

User avatar
By samprice
#3572 I wrapped some of the hardware calls around the arduino api.
I could setup a github project and have people help.

Basically the arudino api is specified here
http://wiring.org.co/reference

Their code is mostly here, but is specialized to the arduino board
https://github.com/arduino/Arduino/tree ... es/arduino

You take their same functions and wrap the esp8266 calls around them.

ie for working with pins / pullups you would do this kind of stuff.
I just got jcmvbkbc C++ compiler working (in ubuntu), so I can start doing C++ stuff.
Wish I could get it working on mac.....

Most of arduino's api is in C++.
IE the arduinos serial port is all c++.

I have a 4mb flash on my esp8266 which is a bit bigger than most others.

Some examples of wrapping the esp basic api calls to the arduino code.
Code: Select allvoid pullup(int inpin)
{
   PIN_PULLUP_EN(inpin);

}
void noPullup(int inpin)
{
   PIN_PULLUP_DIS(inpin);
}
void pinMode(int pin, int value)
{
   // Set GPIO12 as input, then gpio_output_set (0, 0, 0, BIT12).
   if(value == INPUT)
   {
      GPIO_DIS_OUTPUT(pin);
   }
   else{
      GPIO_OUTPUT_SET(pin,0);
   }
}
void digitalWrite(int outpin, int val)
{
   GPIO_OUTPUT_SET(outpin,val & 0x1);
}
int digitalRead(int pin)
{
   return GPIO_INPUT_GET(pin);
}
User avatar
By alonewolfx2
#3585 I am so excited :) I have a question for you. Firstly thanks your working.
1- how can we compile c++ (I have Ubuntu 64 and crostool-ng)
2- how can we upload compiled code on arduino? For example Do we need fuse bits?
User avatar
By gerardwr
#3591 Brilliant!

I jumped into Lua for now, but would chuck that all away when programming in Arduino would be a suitable alternative.

Ofcourse you would need at least a wifi library, in addition to the basic Arduino statements.

Can't help you with development of such an environment but if you need testers, count me in.

BTW: I read a post on this board from a user that has toolchain To compile C code on his Mac. I got the Lubuntu VM working on My Mac using Virtual box. After some initial trouble the AT sample compiled OK, but never tested an actual upload.
User avatar
By samprice
#3653 I got the gcc compiler to C/ C++ programs on mac / ubuntu 64 following steps I posted on another form location.
Mac wont link the libraries (.a files) for me though, so im working in ubuntu lately.

arduino code is c/c++ in the backend.
Main goal is just to take other peoples sketches and use them on the esp8266.

I also got javascript callbacks written for most of the wifi configuration parameters.
After I get the arduino calls wrapped more ill prob make javascript callbacks for em.

This is my wifi configuration page.
Image
Image