Changes between Version 21 and Version 22 of ControlSystems/Electrical/Training/FallTraining
- Timestamp:
- Dec 6, 2020, 2:03:21 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/Electrical/Training/FallTraining
v21 v22 20 20 LEDs only light up when they are connected so that electricity flows through it in the correct direction. The cathode side of the LED, which is the shorter metal leg, gets connected to the ground of the Arduino. The anode side of the LED, the longer leg, is connected to the digital pins. 21 21 This will require some code, which is provided: 22 void setup() 23 { 24 pinMode(2, OUTPUT); 25 } 22 void setup()\\ 26 23 27 void loop() 28 { 29 digitalWrite(2, HIGH); 30 delay(1000); // Wait for 1000 millisecond(s) 31 digitalWrite(2, LOW); 32 delay(1000); // Wait for 1000 millisecond(s) 33 } 24 {\\ 25 26 pinMode(2, OUTPUT);\\ 27 28 }\\ 29 30 31 void loop()\\ 32 33 {\\ 34 35 digitalWrite(2, HIGH);\\ 36 37 delay(1000); // Wait for 1000 millisecond(s)\\ 38 39 digitalWrite(2, LOW);\\ 40 41 delay(1000); // Wait for 1000 millisecond(s)\\ 42 43 }\\ 44 34 45 Just copy and paste this into the code section of TinkerCAD (its the button next to start simulation, and after that, change the code type to text, and not blocks), or your arduino software (which is found at Software | Arduino) which you will need to have the arduino connected to your computer by USB to upload the code. 35 46 Finally, press start simulation on TinkerCAD, or press the upload button on your arduino software if you are using the arduino kit.