Thinger.io
Raspberry Pi:
Requisitos--Requirements:
Sistema operativo Raspberry Pi OS 32bit o 64bit.
Hacer tu cuenta gratis y registrar tu raspberry pi.
A C++ compiler (GCC or Clang)
CMake to guide the compiling and search installed libraries
OpenSSL for using secure connections with the platform
Boost Libraries used for high performance async input/output
Install dependencies:
sudo apt install -y gcc
sudo apt install -y g++
sudo apt install -y cmake
sudo apt install -y libssl-dev
sudo apt install -y libboost-system-dev
sudo apt install -y libboost-thread-dev
sudo apt install -y libboost-program-options-dev
sudo apt install -y libboost-regex-dev
WiringPi:
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
./build
Make a Thinger.io account:
Presionamos--Press +Create Device
Rellenamos el formulario--Fill the form:
Device Type: Generic Thinger Device (WiFi, Ethernet, GSM)
Device Id: Raspberry
Device Credentials: ADifficultPasswordLike1234
Device Name: Raspberry Pi Zero 2W
Device Description: A nice SBC
Presionamos--Press Green button Add Device
Clonamos el Cliente para Linux, entramos a la carpeta clonada--Clone the Linux Client and move to the new directory:
git clone https://github.com/thinger-io/Linux-Client.git
cd Linux-Client/
Ahora agregamosnuestros datos en--Now we need to add our data to main.cpp:
nano src/main.cpp
Buscamos las siguientes constantes y las definimos con nuestros datos--Look for the next constants and define them with your data:
#define USER_ID thinger.io user.
#define DEVICE_ID Raspberry (Lo definimos en--We defined on Add Device).
#define DEVICE_CREDENTIAL ADifficultPasswordLike1234. (Lo definimos en--We defined on Device Credentials).
Luego de editado guadamos y cerramos--After edit save and close:
Ctrl+x
Y
Enter.
Compillamos con el--Compille with the script run.sh:
./run.sh
Si todo va bien veremos como el programa será compilado y ejecutado automáticamente.--If all works fine, it should be compiled and executed automatically.
Regresamos al Dashboard de thinger.io y veremos nuestras Raspberry Pi conectada--Back to the thinger.io's Dashboard and we can see our Raspberry Pi connected:
Statistics
Status
Para probar seleccionamo Device Raspberry Pestaña API --> sum e ingresamos 2 valores en Resource Input, tras lo cual pulsamos Run:
Podemos observar que la API solo suma enteros, ya que nuestra Pi le ha devuelto un entero--We can see that the API just sum integers, our Pi back just an integer.
Si pulsamos--If we push Show Query we can see--Podremos ver:
Ahora si cerramos la Terminal la conexión se cierra-- Now if we close the Terminal the conection will be closed.
Así que instalaremos el Cliente como un Daemon --So we install the Client like a Daemon to start automatically when the pi boot up.
Cerramos la Terminal actual y abrimos una nueva, nos movemos al siguiente directorio--Close the current Terminal and open a new one, we move to the next path:
cd $HOME/Linux-Client/install/raspberry
Daremos permisos de ejecución al--We need to give executable perms to the script install.sh:
chmod +x install.sh
Luego lo ejecutamos--Then we run it:
./install.sh
Esto copiará un--This will copy an init script a--to /etc/init.d/thinger y copiara el binario compilado a--and copy the binary to /usr/local/bin/thinger
Ahora podemos hacer lo que queramos programando la Raspberry Pi en cpp.--Now we can program our Raspberry Pi in cpp:
Cada vez que deseemos modificar nuestro código--Everytime we modify our code main.cpp debemos volver a ejecutar--we should execute install.sh to compile our new code--que compilará nuestro nuevo código:
cd $HOME/Linux-Client/install/raspberry && ./install.sh
Desinstalar--Uninstall:
Así que, para remover el Daemon deberemos detener el servicio y luego eliminar esos 2 archivos si ya no queremos utilizar thinger.io--So to remove the Daemon we need to stop the service and the delete those files if we dont use thinger.io anymore:
sudo systemctl stop thinger
sudo rm /etc/init.d/thinger
sudo rm /usr/local/bin/thinger
sudo reboot
Docs:
Arduino:
Abrimos--Open Arduino IDE
Vamos a la opción:
Programa--Sketch
Incluir librería--Include Library
Gestionar librerías--Manage Libraries
Escribimos thinger en el buscador--Type thinger in the search box
Le damos a instalar a la libreria--Install thinger.io by Thinger.io
Presionamos Cerrar luego de instalado.--Close after install
Ethernet shield
Donde debemos editar--We need edit:
username
device id
device credentials
WiFi Shield:
Donde debemos editar--We need edit:
username
device id
device credentials
wifi_ssid
wifi_password