Skip to content

Instantly share code, notes, and snippets.

View Franck1333's full-sized avatar
🐍
I'm trying new things

Franck Rochat Franck1333

🐍
I'm trying new things
View GitHub Profile
@Franck1333
Franck1333 / Particule_GPT_1_low-cpu.py
Created September 26, 2023 22:46
Génération d'illustration simple et aléatoires, grâce à GPT-3
#Aides: GPT-3
# Importe la bibliothèque tkinter pour créer l'interface graphique
import tkinter as tk
import random
# Définit une fonction pour générer une couleur aléatoire
def random_color():
r = random.randint(0, 255) # Génère une valeur rouge (0-255)
g = random.randint(0, 255) # Génère une valeur verte (0-255)
b = random.randint(0, 255) # Génère une valeur bleue (0-255)
@Franck1333
Franck1333 / Gestion_des_Exceptions.py
Created August 6, 2023 22:30
Gestion des Exceptions (Erreurs) PYTHON
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#ROCHAT_FRANCK
#Gestion des exceptions dans une fonction standard ; sans indication du type d'exption à gérer.
def fonctionUNE():
try:
numeroUNO = 1
#numeroUNO = 1 + a
print(numeroUNO)
@Franck1333
Franck1333 / LED_firing.ino
Created August 3, 2020 14:31
Petit jeux de lumières avec LED sur une carte Arduino.
const int GroupeLED1 = 5; //Composition LED: 1 et 3.
const int GroupeLED2 = 6; //Composition LED: 2 et 4.
int luminosite = 0; //Luminositee des LEDs.
int degraderNB = 5; //Nombre de degrader des LEDs.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
@Franck1333
Franck1333 / DotMatrix8_8.ino
Last active July 18, 2020 14:21
That's how to use a 8*8 regular Matrix with the MAX7219 chip on Arduino boards.
/* Basic example code for MAX7219 LED dot matrix display with Arduino. More info: https://www.makerguides.com */
//AIDE: https://www.makerguides.com/max7219-led-dot-matrix-display-arduino-tutorial/
//AIDE {Sprite Generator}: https://gurgleapps.com/tools/matrix
//AIDE {Sprite Generator}: https://amperka.github.io/led-matrix-editor/
//-----LIB_MATRICE-----
// Include the required Arduino libraries:
// Declaration des libs necessaires
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
@Franck1333
Franck1333 / Distributeur_de_Boisson_OLED.ino
Created July 6, 2020 17:43
Programme Arduino simple ayant pour but de tester la valeur du bouton d'action pour déclencher oui/non le relay connecter a la pompe.
//This example has to be used with any SSD1306 screen Vertical/Horizontal screen with ~1" spec.
//This example use the Adafruits libs.
//AIDE: http://adafruit.github.io/Adafruit_SSD1306/html/index.html
//AIDE: https://projetsdiy.fr/ssd1306-mini-ecran-oled-i2c-128x64-arduino/
//---DECLARATION_SCREEN---
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
@Franck1333
Franck1333 / Simple_GPS_OLED.ino
Last active June 25, 2020 19:05
Get GPS informations ona Arduino board with TinyGPS++ Lib.
//WORK "GPS": https://gist.github.com/Franck1333/440ed64edd6b3c941c3947eb071fdc19
//WORK "OLED": https://gist.github.com/Franck1333/133faba76fa7695bb177bbba9376cf86
//---Screen Lib---
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//---Screen Lib---
@Franck1333
Franck1333 / GPS_Exemple.ino
Last active June 24, 2020 15:23
Example of the use of a GPS on Arduino board.
//HARDWARE: https://tinyurl.com/AZYgpsUBLOX
//AIDE: https://lastminuteengineers.com/neo6m-gps-arduino-tutorial/
//AIDE: http://arduiniana.org/libraries/tinygpsplus/#:~:text=TinyGPS%2B%2B%20is%20a%20new,course%20from%20consumer%20GPS%20devices.
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
// Choose two Arduino pins to use for software serial
int RXPin = 2;
int TXPin = 3;
@Franck1333
Franck1333 / app.py
Created April 24, 2020 15:14
Make a webserver with Python and Flask together!
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#https://projects.raspberrypi.org/en/projects/python-web-server-with-flask/
from flask import Flask, render_template
app = Flask(__name__)
#Static
@app.route('/')
@Franck1333
Franck1333 / DHT11.ino
Created March 3, 2020 10:45
Temp/Humidity Sensor DHT11 on Arduino (Nano in this case).
//AIDES: https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-an-arduino/
#include <dht.h>
dht DHT;
#define DHT11_PIN 7
void setup(){
Serial.begin(9600);
@Franck1333
Franck1333 / M-P1.py
Last active February 18, 2020 14:29
Multi-Processing #1
#Aides: https://tutorialedge.net/python/python-multiprocessing-tutorial/
from multiprocessing import Process #Declaration de l'Utilisation de la LIB MultiProcessing
import random #Declaration de l'Utilisation de la LIB random
def rand_num(): #Cette fonction permet de creer un ou plusieur Nombre aleatoirement pour l'exemple
num = random.random()
print(num) #Affichage des Nombre aleatoirement generer
if __name__ == "__main__":