andrewslobford
Member
Hi everyone! I cant seem to find any tutorials on how to use the teensy 4.1 microSD so Im offering to make one for youtube if someone can help with the code.
The project will have the following:
Teensy 4.1
microsd card
2 x buttons (one wired to pin 7 and one wired to pin 8)
2 x resistors
1 x10k potentiometer.
The goal will be to read the value of the potentiometer and print it when the value is changed
Pressing the button wired to pin 7 will save the current value of the potentiometer to the SD card
Pressing the button wired to pin 8 will print the value saved to the sd card.
here is a schematic of what it'll look like (very simple)
and here's what the wiring will end up lookin like
Im horrible at coding but heres a starting point....
The project will have the following:
Teensy 4.1
microsd card
2 x buttons (one wired to pin 7 and one wired to pin 8)
2 x resistors
1 x10k potentiometer.
The goal will be to read the value of the potentiometer and print it when the value is changed
Pressing the button wired to pin 7 will save the current value of the potentiometer to the SD card
Pressing the button wired to pin 8 will print the value saved to the sd card.
here is a schematic of what it'll look like (very simple)
and here's what the wiring will end up lookin like
Im horrible at coding but heres a starting point....
Code:
/* how to save to SSD Tutorial
This example code is in the public domain.
*/
void setup() {
Serial.begin(38400);
pinMode(7, INPUT);
pinMode(8, INPUT);
}
int val = analogRead(A0);
void loop()
{
int val = analogRead(A0); // reads the pot to see the current value
Serial.print("The value is: "); //prints the value of the pot
Serial.println(val);
if (digitalRead(7) == HIGH) { //if the button wired to pin 7 is pressed - save the value of the pot to the sd card
Serial.println("value saved!!!!!!!!");
}
if (digitalRead(8) == HIGH) { // if the button wired to pin 8 is pressed - print the value of the saved value
Serial.print("the saved value is:");
}
delay(250);
}