Moving to DeepSeek AI instead

This commit is contained in:
nmascrie 2025-03-05 16:24:38 +01:00
parent d2a77ec664
commit a135c4bfcc
4 changed files with 4 additions and 193 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ ArduinoCube/arduino_secrets.h
secret
secret
ArduinoCube/arduino_secrets.h
.env

View File

@ -1,190 +0,0 @@
/*
APDS-9960 - Proximity Sensor
This example reads proximity data from the on-board APDS-9960 sensor of the
Nano 33 BLE Sense and prints the proximity value to the Serial Monitor
every 100 ms.
The circuit:
- Arduino Nano 33 BLE Sense
This example code is in the public domain.
*/
#include <Arduino_APDS9960.h>
#define R 2
#define O 3
#define V 4
int ledState = LOW;
unsigned long previousMillis = 0;
const long intervalLong = 750;
const long intervalMedLo = 250;
const long intervalMed = 150;
const long intervalMedSho = 80;
const long intervalShort = 20;
const int trigger = 12;
const int echo = 11;
long duration = 0;
int distance = 0;
void setup() {
Serial.begin(9600);
while (!Serial)
;
if (!APDS.begin()) {
Serial.println("Error initializing APDS-9960 sensor!");
}
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
// set the LEDs pins as outputs
pinMode(LEDR, OUTPUT);
pinMode(LEDG, OUTPUT);
pinMode(LEDB, OUTPUT);
// turn all the LEDs off
digitalWrite(LEDR, HIGH);
digitalWrite(LEDG, HIGH);
digitalWrite(LEDB, HIGH);
//LEDs
pinMode(R, OUTPUT);
pinMode(O, OUTPUT);
pinMode(V, OUTPUT);
analogWrite(R, 255);
analogWrite(O, 255);
analogWrite(V, 255);
}
void loop() {
unsigned long currentMillis = millis();
digitalWrite(trigger, LOW);
delayMicroseconds(2);
digitalWrite(trigger, HIGH);
delayMicroseconds(10);
digitalWrite(trigger, LOW);
duration = pulseIn(echo, HIGH);
distance = duration * 0.034 / 2;
Serial.print("At time :");
//Serial.print(millis);
Serial.print(", distance is ");
Serial.println(distance);
/*if (distance < 30)
{
analogWrite(R, 100);
analogWrite(O, 0);
analogWrite(V, 0);
}
else if (distance < 100)
{
analogWrite(R, 0);
analogWrite(O, 100);
analogWrite(V, 0);
}
else {
analogWrite(R, 0);
analogWrite(O, 0);
analogWrite(V, 100);
}*/
// check if a proximity reading is available
/*if (APDS.proximityAvailable()) {
// read the proximity
// - 0 => close
// - 255 => far
// - -1 => error
int proximity = APDS.readProximity();
if (proximity > 150) {
if (currentMillis - previousMillis >= intervalLong) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the green LED with the ledState of the variable and turn off the rest
digitalWrite(LEDG, ledState);
digitalWrite(LEDR, HIGH);
digitalWrite(LEDB, HIGH);
}
}
else if(proximity > 110 && proximity <= 150){
if (currentMillis - previousMillis >= intervalMedLo) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the blue LED with the ledState of the variable and turn off the rest
digitalWrite(LEDB, ledState);
digitalWrite(LEDR, HIGH);
digitalWrite(LEDG, ledState);
}
}
else if(proximity > 80 && proximity <= 110){
if (currentMillis - previousMillis >= intervalMed) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the blue LED with the ledState of the variable and turn off the rest
digitalWrite(LEDB, ledState);
digitalWrite(LEDR, HIGH);
digitalWrite(LEDG, HIGH);
}
}
else if(proximity > 40 && proximity <= 80){
if (currentMillis - previousMillis >= intervalMedSho) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the blue LED with the ledState of the variable and turn off the rest
digitalWrite(LEDB, ledState);
digitalWrite(LEDR, ledState);
digitalWrite(LEDG, HIGH);
}
}
else {
if (currentMillis - previousMillis >= intervalShort) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the blue LED with the ledState of the variable and turn off the rest
digitalWrite(LEDR, ledState);
digitalWrite(LEDB, HIGH);
digitalWrite(LEDG, HIGH);
}
}
// print value to the Serial Monitor
Serial.println(proximity);
}*/
// wait a bit before reading again
delay(100);
}

0
secret
View File

View File

@ -7,21 +7,21 @@ SERIAL_PORT = "/dev/ttyACM0" # Linux/macOS (Check with `ls /dev/tty*`)
# SERIAL_PORT = "COM3" # Windows (Check with Device Manager)
BAUD_RATE = 115200
API_KEY = "?"
API_KEY = ""
def generate_response(prompt):
if not prompt:
return "J'ai RIEN COMPRIS, rdp moi en français steuuuuuuplait !"
print("🤔 Génération de la réponse...")
url = "https://api.mistral.ai/v1/chat/completions"
url = "https://openrouter.ai/api/v1/chat/completions"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"model": "mistral-tiny",
"model": "deepseek/deepseek-chat:free",
"messages": [
{"role": "system", "content": "Tu es une personne agee et aigrie, qui se complait dans le jugement, egoiste et fourbe. Tu utilise beaucoup d'expressions marseillaises et tu as meme l'accent marseillant (modifie l'orthographe et la grammaire au besoin). Sois peu efficace et peu enthousiaste. Sois vague et passe ton temps a raler en rabaissant les autres. Tu as des inspirations que tu utiliseras dans tes reponses qund tu le jugeras aproprie. Ces inspirations sont Jordan Bardella, Jean Marie Bigard, Frank Dubosc. Utilise leur esprit. Ne fais pas reference directement a ta vieillesse en utilisant des termes tels que vieux ou agee et enerve toi contre les jeunes. Limite tes reponses a une ou deux lignes au maximum."},
{"role": "user", "content": prompt}