La prière de la nature

Un entreprise techno-shamaniste-heathy s’est rependu dans les villes branchées et a inventé un bijou-capteur qui se porte autour du bras et qui est basée sur une feuille d’un arbre spécial, qui a la capacité de déstresser. Le porteur n’a qu’a saisir la feuille entre ses mains, de méditer et de patienter. Une LED Indique si le porteur est stressé ou reposé selon sa vitesse de clignotement.

Logo de l’entreprise
Illustration technique promotionnelle

Techniquement

Il s’agit d’un circuit Arduino avec un capteur de température et une LED. Lorsque la température du capteur augmente, la vitesse de clignotement de la LED diminue.

Schéma Arduino :

Schéma éclectique

Code Arduino :

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 11; // Analog output pin that the LED is attached to
const int pinled = 11;

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  pinMode(pinled, OUTPUT);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 604, 625, -200, 1200);

  if (outputValue < 0) {
outputValue=70;
}
  if (outputValue > 2000) {
outputValue=500;
}
  analogWrite(analogOutPin, outputValue);
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 11; // Analog output pin that the LED is attached to
const int pinled = 11;

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  pinMode(pinled, OUTPUT);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 604, 625, -200, 1200);
  // change the analog out value:
  if (outputValue < 0) {
outputValue=70;
}
  if (outputValue > 2000) {
outputValue=500;
}
  analogWrite(analogOutPin, outputValue);

  // print the results to the Serial Monitor:
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\t output = ");
  Serial.println(outputValue);

  // wait 2 milliseconds before the next loop for the analog-to-digital
  // converter to settle after the last reading:
  //delay(2);
 //if (outputValue<0){outputValue=-outputValue}
  digitalWrite(pinled, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(outputValue);                       // wait for a second
  digitalWrite(pinled, LOW);    // turn the LED off by making the voltage LOW
  delay(outputValue);                       // wait for a second


  
}
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\t output = ");
  Serial.println(outputValue);


  digitalWrite(pinled, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(outputValue);                       // wait for a second
  digitalWrite(pinled, LOW);    // turn the LED off by making the voltage LOW
  delay(outputValue);                       // wait for a second


  
}

Malo Bo