This repository contains libraries and all of configurations to start prototype objects in the APIO system
This repository contains the hardware folder for Arduino IDE, include coordinator sketch and include an example objects.
You need:
===========
cd /path/to/your/directory
git clone https://github.com/ApioLab/library-arduino.git
copy hardware folder in your Arduino folder(default in Documents folder)
Open Arduino IDE and Select Apio General in Boards menu
Create your first application with Apio SDK [see here](http://www.apio.cc/en/wiki#ch-1-4)
Apio identifies any object (real or virtual) as a set of properties that assume specific values: this kind of encode is not only a “language”, but also a characterization of the object itself. In fact, the pair property:value defines univocally an action of the object, it represents a command. The list of all these pairs defines its Dictionary: that is all the things the object can do. This is what allows you to abstract from the concept of real object relieving the Software developer from the Hardware knowledge and vice versa. It is not important how it carries out these actions nor how they are implemented; what matters is knowing the pair property:value that will generate a specific action. Knowing the Dictionary of a Friend Object means being able to talk to it.
So if assume that I have created a LED and I want to codify that in APIO, I have a function like this:
onoff(pin, value)
that will write on the pin of the LED.
So in the loop of the microcontroller I will write:
void loop(){
apioLoop();
if(property=="onoff"){
if(value=="1") {
onoff(LED, 1);
}
if(value=="0"){
onoff(LED, 0);
}
}
}
apioLoop ()
allows you to receive messages and select the current pair property:value to be processed in the current main loop. This is because the sketch have the ability to queue multiple commands from the server, but you have to worry only to check the value of variables called 'property' and 'value' because on each loop, the function apioLoop() stores in these varibiabiles an element of the queue (of course only if multiple commands are sent or the main loop has not had time to execute the previous one, before the arrival of subsequent commands)
To send messages to the server you can use void apioSend(String toSend)
. .....apioSend()
And that's all.
Now you have all the knowledge to codify all of your project with APIO.
Choose your communication channel, see the EXAMPLE and create your objects