Skip to content
Snippets Groups Projects
Commit eee3961f authored by Dan Stone's avatar Dan Stone
Browse files

Embedded week main upload and week0 video clean up

parent 88fcf8f2
No related branches found
No related tags found
No related merge requests found
Pipeline #375437 passed
Showing
with 781 additions and 44 deletions
......@@ -55,8 +55,7 @@ well and so far so good….. 2 hours later I got all the components down with li
managed to get some solder into the connection bolts which made testing a little more complicated. After
a little clean up…..success a blinking red light!
![blinking 555](<iframe src="https://player.vimeo.com/video/794613886?h=a69d6730e7" width="640" height="853" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>
<p><a href="https://vimeo.com/794613886">555blink.mp4</a> from <a href="https://vimeo.com/user193813020">Dan Stone</a> on <a href="https://vimeo.com">Vimeo</a>.</p>)
![blinking 555](../images/imagW0/Blinking555.gif)
I did chuckle to myself as the factories I ran as President for Lenovo Latin America had 4
robotic SMD lines for board manufacturing. It was much easier to watch the robots then trying
......@@ -186,7 +185,7 @@ who reminded me the difference between = and ==..code issue solved but still noy
a sketch that only turned on led by setting pin 2 to HIGH / then uploaded another sketch with PIN 2
set to LOW. Led turn on + turned off--> we are good on output. I uploaded the original code still no joy
the light was on all the time not only when I pressed the button
```
```c
void setup()
{ pinMode(2,OUTPUT); }
......@@ -213,12 +212,7 @@ button was defective. A quick component replacement and we were off the the race
![412button](<iframe src="https://player.vimeo.com/video/794608011?h=5dc4669cbe" width="640" height="853" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>
<p><a href="https://vimeo.com/794608011">412button.mp4</a> from <a href="https://vimeo.com/user193813020">Dan Stone</a> on <a href="https://vimeo.com">Vimeo</a>.</p>)
![412button](../images/imagW0/Button412.gif)
## Intro to the 412 - Input - Photo resistor
......@@ -267,7 +261,8 @@ And we are off to the races
Here is the circuit in action
<iframe src="https://drive.google.com/file/d/1Fsrrr-0uStcFpBsU4H1UIkwMCUTIt83M/preview" width="640" height="480" allow="autoplay"></iframe>
![Phohoresistor](../images/imagW0/Photoresistor.gif)
## Milling our first board - blinking 412
......@@ -302,7 +297,7 @@ Solution - press the change tool button at the top right and follow direction
Video of the milling process:
<iframe src="https://drive.google.com/file/d/1Gba4-RiLTIi_NhjzPRCU2cuQWrx73YJI/preview" width="640" height="480" allow="autoplay"></iframe>
![Board Mill](../images/imagW0/412Boardmill.gif)
![412 board 2nd try](../images/imagW0/412boardmill2ndtry.jpg)
......@@ -352,8 +347,4 @@ Now to use the arduino uno / JTAG to upload the sketch to 412 …. Blinking ligh
Video of blinking light:
<iframe src="https://drive.google.com/file/d/1GPGsOmQuPfhIr5bNHoeackjF6qvNIDFQ/preview" width="640" height="480" allow="autoplay"></iframe>
![412](../images/imagW0/Blinking412board.gif)
\ No newline at end of file
This diff is collapsed.
File added
File added
from machine import Pin, Timer
led = Pin(15, Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=10.5, mode=Timer.PERIODIC, callback=blink)
\ No newline at end of file
from machine import Pin, UART
import time
# Define Morse code patterns for each letter
dot_duration = 0.25 # Duration of a dot in seconds
dash_duration = 3 * dot_duration # Duration of a dash (3 times the duration of a dot)
inter_symbol_gap = dot_duration # Gap between symbols (same duration as a dot)
inter_letter_gap = 3 * dot_duration # Gap between letters (3 times the duration of a dot)
inter_word_gap = 7 * dot_duration # Gap between words (7 times the duration of a dot)
morse_table = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---',
'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---',
'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-',
'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--',
'Z': '--..'
}
led_pin = Pin(25, Pin.OUT) # LED pin number
uart = UART(0, baudrate=9600) # Initialize UART communication at 9600 bps
while True:
if uart.any():
input_char = uart.read(1).decode().upper() # Read the input character and convert to uppercase
if input_char in morse_table:
morse_pattern = morse_table[input_char] # Get the Morse code pattern for the input letter
for symbol in morse_pattern:
if symbol == '.': # If current symbol is a dot, turn on the LED for the duration of a dot
led_pin.on()
time.sleep(dot_duration)
led_pin.off()
time.sleep(inter_symbol_gap)
elif symbol == '-': # If current symbol is a dash, turn on the LED for the duration of a dash
led_pin.on()
time.sleep(dash_duration)
led_pin.off()
time.sleep(inter_symbol_gap)
time.sleep(inter_letter_gap) # Add gap between letters
elif input_char == ' ': # If input is a space, add gap between words
time.sleep(inter_word_gap)
// Define Morse code patterns for each letter
const int dotDuration = 250; // Duration of a dot in milliseconds
const int dashDuration = 3 * dotDuration; // Duration of a dash (3 times the duration of a dot)
const int interSymbolGap = dotDuration; // Gap between symbols (same duration as a dot)
const int interLetterGap = 3 * dotDuration; // Gap between letters (3 times the duration of a dot)
const int interWordGap = 7 * dotDuration; // Gap between words (7 times the duration of a dot)
const char* morseTable[] = {
".-", // A
"-...", // B
"-.-.", // C
"-..", // D
".", // E
"..-.", // F
"--.", // G
"....", // H
"..", // I
".---", // J
"-.-", // K
".-..", // L
"--", // M
"-.", // N
"---", // O
".--.", // P
"--.-", // Q
".-.", // R
"...", // S
"-", // T
"..-", // U
"...-", // V
".--", // W
"-..-", // X
"-.--", // Y
"--.." // Z
};
int ledPin = 15; // LED pin number
char inputChar; // Character received from the computer
const char* morsePattern; // Morse code pattern for the input character
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 bps
pinMode(ledPin, OUTPUT); // Set LED pin as output
}
void loop() {
if (Serial.available() > 0) { // Check if data is available on serial port
inputChar = Serial.read(); // Read the input character
inputChar = toupper(inputChar); // Convert input character to uppercase
if (isalpha(inputChar)) { // Check if input is a letter
morsePattern = morseTable[inputChar - 'A']; // Get the Morse code pattern for the input letter
for (int i = 0; i < strlen(morsePattern); i++) { // Loop through the Morse code pattern
if (morsePattern[i] == '.') { // If current symbol is a dot, turn on the LED for the duration of a dot
digitalWrite(ledPin, HIGH);
delay(dotDuration);
digitalWrite(ledPin, LOW);
delay(interSymbolGap);
} else if (morsePattern[i] == '-') { // If current symbol is a dash, turn on the LED for the duration of a dash
digitalWrite(ledPin, HIGH);
delay(dashDuration);
digitalWrite(ledPin, LOW);
delay(interSymbolGap);
}
}
delay(interLetterGap); // Add gap between letters
} else if (inputChar == ' ') { // If input is a space, add gap between words
delay(interWordGap);
}
}
}
// Define the pin numbers for the sensors and actuators
const int LED_PIN = 7;
const int WASH_BUTTON_PIN = 11;
const int DRY_BUTTON_PIN = 10;
const int FULL_BUTTON_PIN = 9;
const int WATER_SENSOR_PIN = 2;
const int LID_SENSOR_PIN = 3;
const int DRUM_PIN = 4;
const int WATER_PUMP_PIN = 5;
void setup() {
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
pinMode(WASH_BUTTON_PIN, INPUT);
pinMode(DRY_BUTTON_PIN, INPUT);
pinMode(FULL_BUTTON_PIN, INPUT);
pinMode(WATER_SENSOR_PIN, INPUT);
pinMode(LID_SENSOR_PIN, INPUT);
pinMode(DRUM_PIN, OUTPUT);
pinMode(WATER_PUMP_PIN, OUTPUT);
}
void loop() {
// Wait for the wash button press
if (digitalRead(WASH_BUTTON_PIN) == HIGH) {
// Check the water level and lid status
if (digitalRead(WATER_SENSOR_PIN) == LOW && digitalRead(LID_SENSOR_PIN) == LOW) {
// Start the wash cycle
digitalWrite(DRUM_PIN, HIGH);
digitalWrite(WATER_PUMP_PIN, HIGH);
delay(600);
digitalWrite(DRUM_PIN, LOW);
digitalWrite(WATER_PUMP_PIN, LOW);
delay(400);
digitalWrite(WATER_PUMP_PIN, HIGH);
delay(400);
digitalWrite(WATER_PUMP_PIN, LOW);
} else {
Serial.println("Not enough water or lid is open.");
digitalWrite(LED_PIN, HIGH);
}
}
// Wait for the dry button press
if (digitalRead(DRY_BUTTON_PIN) == HIGH) {
// Start the slow spin
if (digitalRead(LID_SENSOR_PIN) == LOW) {
digitalWrite(DRUM_PIN, HIGH);
delay(600);
// Start the fast spin
digitalWrite(DRUM_PIN, LOW);
delay(300);
digitalWrite(DRUM_PIN, HIGH);
delay(300);
digitalWrite(DRUM_PIN, LOW);
} else {
Serial.println("lid is open.");
digitalWrite(LED_PIN, HIGH);
}
}
// Wait for the full cycle button press
if (digitalRead(FULL_BUTTON_PIN) == HIGH) {
// Perform the wash cycle
if (digitalRead(WATER_SENSOR_PIN) == LOW && digitalRead(LID_SENSOR_PIN) == LOW) {
// Start the wash cycle
digitalWrite(DRUM_PIN, HIGH);
digitalWrite(WATER_PUMP_PIN, HIGH);
delay(600);
digitalWrite(DRUM_PIN, LOW);
digitalWrite(WATER_PUMP_PIN, LOW);
delay(400);
digitalWrite(WATER_PUMP_PIN, HIGH);
delay(400);
digitalWrite(WATER_PUMP_PIN, LOW);
} else {
Serial.println("Not enough water or lid is open.");
digitalWrite(LED_PIN, HIGH);
return;
}
// Perform the dry cycle
// Start the slow spin
if (digitalRead(LID_SENSOR_PIN) == LOW) {
digitalWrite(DRUM_PIN, HIGH);
delay(200);
// Start the fast spin
digitalWrite(DRUM_PIN, HIGH);
delay(200);
digitalWrite(DRUM_PIN, LOW);
delay(200);
digitalWrite(DRUM_PIN, HIGH);
delay(100);
digitalWrite(DRUM_PIN, LOW);
} else {
Serial.println("Not enough water or lid is open.");
digitalWrite(LED_PIN, HIGH);
return;
}
}}
docs/images/ImagW4/Arduino1circuit.jpg

140 KiB

File added
docs/images/ImagW4/R20401boardmanager.jpg

132 KiB

docs/images/ImagW4/R20404Picopinout.jpg

173 KiB

docs/images/ImagW4/R2040GPT1.jpg

133 KiB

docs/images/ImagW4/R2040GPT2.jpg

110 KiB

File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment