Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **Pin Control**
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2025-06-02 21:43:39
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Turn this code into tinkercad block code */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <Tinkercad.h> // Include Tinkercad library for block code functionality
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- // USER CODE VARIABLES
- int i;
- int time = 100;
- int readSpeed;
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(A0, INPUT); // Set A0 as input for reading analog values
- for(i = 1; i <= 13; i++)
- {
- pinMode(i, OUTPUT); // Set pins 1 to 13 as outputs
- }
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Start Turn On
- for(i = 1; i <= 13; i++)
- {
- readSpeed = analogRead(A0); // Read the analog value from A0
- time = map(readSpeed, 0, 1023, 100, 1000); // Map the read value to a time delay
- digitalWrite(i, HIGH); // Turn on the current pin
- delay(time); // Wait for the mapped time
- }
- // Start Turn Off
- for(i = 1; i <= 13; i++)
- {
- readSpeed = analogRead(A0); // Read the analog value from A0
- time = map(readSpeed, 0, 1023, 100, 500); // Map the read value to a time delay
- digitalWrite(i, LOW); // Turn off the current pin
- delay(time); // Wait for the mapped time
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement