Measure something: add a sensor to a microcontroller board that you have designed and read it.
Because of the circumstances we are going through I decided to use my last PCB.
We were getting some extra help from our group by on-line.
Understanding the FTDI chip
The FTDI chips implement the USB protocol stack. The responsibility of this hardware is to tell your PC what it is (using some identification information) such that your computer can load the right driver for it, and also to manage the data transactions with the PC there-on after - look up USB endpoints for a better explanation of these processes.
I had to use soldering to connect the FTDI with the PCB
Then, more programming
Afterward, it didn't work.
//Practice flex sensor, first try
//int i = 0;
void setup() { pinMode(A0, INPUT);
pinMode(11, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
} void loop() { if (analogRead(A0) <= 55) { analogWrite(11, 51);
analogWrite(9, 51);
analogWrite(10, 255);
} else { if (analogRead(A0) <= 58) { analogWrite(11, 51);
analogWrite(9, 204);
analogWrite(10, 0);
} else { if (analogRead(A0) >= 62) { analogWrite(11, 255);
analogWrite(9, 0);
analogWrite(10, 0);
//Practice flex sensor, second try
//#include
SoftwareSerial ftdi(1, 0); // RX, TX
int valor=0;
double flex=0.0;
void setup()
{
ftdi.begin(9600);
pinMode(0,OUTPUT); //Configuracion del pin
digitalWrite(0,LOW); //Inicia el pin en un estado bajo 0 logico o 0 voltios
}
void loop()
{
valor=analogRead(A3);
flex=(valor*5.0)/1024.0;
flex=flex*100.0;
ftdi.println(analogRead(A3));
ftdi.println(valor);
ftdi.println(flex);
ftdi.write("r");
//flex = valor * 5.0 * 100.0 / 1024.0; //
/// if(flex > 70.0)
/// {
//apagar calefactor
//enviar mensaje
//digitalWrite(2,HIGH);
/// digitalWrite(0,LOW);
/// }
/// else
/// {
/// digitalWrite(0,HIGH);
/// }
delay(100); //delay
}
//Practice flex sensor, third try
//#include
SoftwareSerial ftdi(1, 0); // RX, TX
int valor=0;
double flex=0.0;
void setup()
{
ftdi.begin(9600);
pinMode(13,OUTPUT); //Configuracion del pin
digitalWrite(12,LOW); //Inicia el pin en un estado bajo 0 logico o 0 voltios
}
void loop()
{
valor=analogRead(A3);
flex=(valor*5.0)/1024.0;
flex=flex*100.0;
ftdi.println(flex);
// ftdi.write("r");
//flex = valor * 5.0 * 100.0 / 1024.0; //
if(flex > 70.0)
{
//apagar calefactor
//enviar mensaje
//digitalWrite(2,HIGH);
digitalWrite(12,LOW);
}
else
{
digitalWrite(12,HIGH);
}
delay(100); //delay
}
I had to get more information during the classes to practice more with this flex sensor, I made a lot of tries and it was really hard to be honest, the only way to learned about was practice with the simulator, it was when I worked with TinkerCad and I used the different ways they ofered to get the code and test it. Anyway my plan for the final project was directed to apply the use of the flex sensor and for this reason I am showing this example on the video.