Skip to content

Instantly share code, notes, and snippets.

View remisarrailh's full-sized avatar

Rémi Sarrailh remisarrailh

View GitHub Profile
// Récupération de la description
description_raw = msg.payload.split("SUMMARY:");
var description = [];
description_raw.forEach(function (item, index) {
if(index !== 0){
description.push(item.split("\n")[0].trim());
}
});
// Récupération de la date
drawAnimation();
if (animation_direction) {
animation_state--;
} else {
animation_state++;
}
if (animation_state == 5) {
animation_direction = true;
}
if (animation_state == 0) {
void drawAnimation() {
u8g2.firstPage();
do {
switch (animation_state) {
case 0:
u8g2.drawXBMP(0, 0, logo_width, logo_height, logo_1);
break;
case 1:
u8g2.drawXBMP(0, 0, logo_width, logo_height, logo_2);
break;
void loop() {
if (tick.isExpired()) {
drawAnimation();
pos_x = pos_x + X;
if (pos_x > OLED_WIDTH + cannon_width) {
pos_x = -cannon_width;
}
tick.repeat();
}
}
#include <AsyncDelay.h>
const int FPS = 1000 / 30; //30 FPS
AsyncDelay tick; void setup(){
tick.start(FPS, AsyncDelay::MILLIS);
}
void loop(){
if(tick.isExpired()){
//ANIMATION ICI
tick.repeat();
#include <Wire.h> //I2C
#include <U8g2lib.h>
#include "logo.h"
//I2C SSD1306 128x32 (search U8g2 examples for other display)
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void setup() {
u8g2.begin(); //Start Screen
drawLogo();
#define logo_width 128
#define logo_height 32
static const unsigned char logo[] U8X8_PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00...
};
#define _width 128
#define _height 32
static char _bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00...
};
@remisarrailh
remisarrailh / install.sh
Last active March 29, 2019 14:34
Script installation yana temporaire (ignore les erreurs SSL)
#!/bin/bash
# Auteur : Remi Sarrailh (maditnerd)
# Updates : Modifications mineures par Valentin CARRUESCO Idleman 28/07/2018
# Licence : MIT
# Un probleme : https://git.idleman.fr/idleman/yana-server/issues
# https://tldrlegal.com/license/mit-license
#############
# Variables
#############
@remisarrailh
remisarrailh / rtc_scenario.ino
Created February 17, 2019 13:15
rtc_scenario
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
DateTime horloge;
int pin_relai_1 = 13;
int pin_relai_2 = 11;
//Scenario 1