// https://github.com/electric-sheep-co/arduino-redis/tree/master
// https://arduino-redis.com/classRedis.html
// https://www.arduino.cc/reference/en/libraries/redis-for-arduino/
#include <Redis.h>
#include <WiFi.h>
#define WIFI_SSID "Wokwi-GUEST"
#define WIFI_PASSWORD ""
#define REDIS_ADDR "redis-11502.c282.east-us-mz.azure.cloud.redislabs.com"
#define REDIS_PORT 11502
#define REDIS_PASSWORD "disciplinasunicamp"
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to the WiFi");
while (WiFi.status() != WL_CONNECTED)
{
delay(250);
Serial.print(".");
}
Serial.println();
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
WiFiClient redisConn;
if (!redisConn.connect(REDIS_ADDR, REDIS_PORT))
{
Serial.println("Failed to connect to the Redis server!");
return;
}
Redis redis(redisConn);
auto connRet = redis.authenticate(REDIS_PASSWORD);
if (connRet == RedisSuccess)
{
Serial.println("Connected to the Redis server!");
}
else
{
Serial.printf("Failed to authenticate to the Redis server! Errno: %d\n", (int)connRet);
return;
}
Serial.println(redis.rpush("30072024_1603","id",false));
Serial.println(redis.rpush("30072024_1603","hw01",false));
Serial.println(redis.rpush("30072024_1603","A0",false));
Serial.println(redis.rpush("30072024_1603","170",false));
Serial.println(redis.rpush("30072024_1603","A1",false));
Serial.println(redis.rpush("30072024_1603","270",false));
Serial.println(redis.rpush("30072024_1603","A2",false));
Serial.println(redis.rpush("30072024_1603","370",false));
Serial.println(redis.rpush("30072024_1603","A3",false));
Serial.println(redis.rpush("30072024_1603","470",false));
redisConn.stop();
Serial.print("Connection closed!");
}
void loop()
{
}