Home Mail Discord Chat
Go Back   ChiefsPlanet > Lenny "The Cool" Lounge

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 10-13-2021, 08:27 PM   Topic Starter
Monticore Monticore is offline
I love your mom
 
Join Date: Feb 2020
Location: Sturgeon Falls, Ontario
Casino cash: $8379975
Nerd homework

My son needs help with his homework and I know nothing about coding , he is trying to get a RGB strip to light up with increasing intensity as more pressure is applied to sensor while also randomizing a series of colors .(llike a light up shoe)

this is what he has which he knows is horribly wrong i am pretty sure this is C/C+, this is his hisrt ever coding class so his knowledge is fairly limited.
I also know it is in french but it might still make sense to some of you

int valeur1 = 0; //variable de type integer pour enregistrer analog A0
int valeur2 = 0; //variable de type integer pour enregistrer analog A0
int valeur3 = 0;
int valeur4 = 0;
int valeur5 = 0;

void setup() {

Serial.begin(9600); //commence le serial pour ecrire les données
pinMode(A0,INPUT_PULLUP); //prepare A0 pour le pressure sensor
pinMode(3,OUTPUT); //prepare pin 3 pour output de 5V
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}

void loop() {

valeur1 = analogRead(A0);
delay(1000);
valeur2 = (200/valeur1);
valeur3 = (valeur2*valeur2);




valeur4 = random(255);
valeur5 = valeur4;

if (valeur4 > valeur5){
valeur5--;
analogWrite(3,valeur5);

}

if (valeur4 < valeur5){
valeur5++;
analogWrite(3,valeur5);

}

if (valeur4 == valeur5){

valeur5;
analogWrite(3,valeur5);

}







if (valeur4 > valeur5){
valeur5++;
analogWrite(5,valeur5);

}

if (valeur4 < valeur5){
valeur5--;
analogWrite(5,valeur5);

}

if (valeur4 == valeur5){

analogWrite(5,valeur5);

}








if (valeur4 > valeur1){
valeur5++;
analogWrite(6,valeur5);

}

if (valeur4 < valeur5){
valeur5--;
analogWrite(6,valeur5);

}

if (valeur4 == valeur5){

analogWrite(6,valeur5);

}

}

would appreciate any help or insults
Posts: 4,338
Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.Monticore has just been standing around suckin' on a big ol' chili dog.
  Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump




All times are GMT -6. The time now is 09:33 PM.


This is a test for a client's site.
Fort Worth Texas Process Servers
Covering Arlington, Fort Worth, Grand Prairie and surrounding communities.
Tarrant County, Texas and Johnson County, Texas.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2022, vBulletin Solutions, Inc.