im having some problems with this code, when i see what arduino receives from the app it only recives svenuto(fainted) and not the sveglio(awake) one when im awake,
im using a teachable machine to recognise either im awake or fainted. Can someone help me fix what i did wrong its for school
Please also post the ino sketch.
Also, please show what arrives in the result from the classification.
I didnt quite understand what you asked me. But if you're wondering arduino says that im always fainted even if im not. The result from the teachable machine classification is a % that depends if im either fainted or awake. Sorry if im causing problema english isnt my first language
EDIT:
my arduino code is this:
#include <Stepper.h>
#include<SoftwareSerial.h>
SoftwareSerial BT(10,11);
String state;
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
int motorSpeed=100;
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 12, 13);
int stepCount = 0; // number of steps the motor has taken
int blu=5;
int rossa=6;
int verde=4;
void setup() {
// nothing to do inside the setup
BT.begin(9600);
Serial.begin(9600);
pinMode(7,OUTPUT);
pinMode(rossa,OUTPUT);
// luce rossa
pinMode(blu,OUTPUT);
// luce blu
pinMode(verde,OUTPUT);
// luce verde
}
void loop() {
while (BT.available()) {
delay(10);
char c=BT.read();
state+=c;
}
digitalWrite(7,LOW);
digitalWrite(rossa,LOW);
digitalWrite(blu,LOW);
digitalWrite(verde,LOW);
//inizio teacheble machine
if (state.length()>0){
Serial.println(state);
if (state=="Avvia"){
digitalWrite(verde,HIGH);
motorSpeed=100;
myStepper.setSpeed(motorSpeed);
// step 1/100 of a revolution:
myStepper.step(stepsPerRevolution / 100);
delay(100);
if (state=="Sveglio"){
digitalWrite(verde,HIGH);
motorSpeed=100;
myStepper.setSpeed(motorSpeed);
// step 1/100 of a revolution:
myStepper.step(stepsPerRevolution / 100);
delay(100);
}
else {if(state="Svenuto"){
digitalWrite(rossa,HIGH);
digitalWrite(blu,LOW);
digitalWrite(verde,LOW);
digitalWrite(7,HIGH);
delay(1000);
digitalWrite(7,LOW);
for(motorSpeed=100; motorSpeed>1; motorSpeed-=1){
myStepper.setSpeed(motorSpeed);
// step 1/100 of a revolution:
myStepper.step(stepsPerRevolution / 100);
delay(100);
if (motorSpeed<40){
digitalWrite(blu,HIGH);
digitalWrite(rossa,LOW);
digitalWrite(verde,LOW);
}
else{
digitalWrite(blu,LOW);
digitalWrite(rossa,LOW);
digitalWrite(verde,HIGH);
}
}
}
}
}
}
state="";
}
Sorry, I am not familiar with the Image Classifier.
Where do you get it?
Could you post your .aia export so I can see its tool tips?
yes. The image classifier im using comes from the google teacheable machine> image classifier https://teachablemachine.withgoogle.com/. Here is the file
progetto_molto_importante (1).aia (439.3 KB)
I don't have your face, so I can't test your model.
But I CAN add instrumentation to your app so you can see the confidence levels returned from your model, in descending order, in a ListView I added.
The ListView is more flexible, able to show any surprises, like maybe the confidence levels are all fractions of 1.
progetto_molto_importante1 (1).aia (439.8 KB)
Let us know what comes back in the confidence levels in the ListView.
From the tool tips, I suspect those are not dictionaries, or the values ae less than 1.
Thanks imma check that out, you could try it by making ur own image classifier at the link i sent in the last message https://teachablemachine.withgoogle.com/ then putting the upload link of the new image classifier in the teacheable machine extension in the app.
EDIT:
The thing u put in is needed for the if control? Or how should I use it, is it the substitute for the text boxes I use for the if?
Thanks in advance
I added the ListView to show the response from the Teachable Machine classifier (the two column table.) without you stomping all over it.
I have yet to see what your classifier returned.
My classifier returns a percentual based on either if i am awake or not like 98% awake 2% fainted etc... I saw what u did after i sent the question so thanks now my problem is fixed