Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
any arduino based board may work fine
×1
Software apps and online services:
Vs2015logo
Microsoft Visual Studio 2015
Ide web
Arduino IDE

Code

LengthBlinkerArduino
Just upload the code and open Serial Monitor and type anything and send it or press ENTER . The led at pin 13 will blink for the count of input string you have provided.
For example if you enter 'lol' it will blink for 3 times ie equal to the length of the input.
/*
 Name:		lengthBlinker.ino
 Created:	9/28/2017 12:03:23 AM
 Updated: 9/29/2017 01:27:33 AM
 Author:	jeet


 This code will make your arduino's led blink according to the length of input you have provided ..
 Yes this Code is really small and is written just for fun.
 L.....O......L
*/

#define pin 13
// the setup function runs once when you press reset or power the board
void setup() {
	pinMode(13, OUTPUT);
	Serial.begin(250000);
}
int count = 0;
String str;

// the loop function runs over and over again until power down or reset
void loop() {	
	
		str = Serial.readString();  //getting the data from the port
		count = str.length();   
		//finding the length 
		if (count == 0) {
			Serial.println("Please give me some input");

		}
		else
		{
			Serial.println(str);
			//for loop to execute the blinking for count number of times
			for (int i = 0; i < count; i++) 
			{
				digitalWrite(pin, HIGH);
				delay(300);
				digitalWrite(pin, LOW);
				Serial.print("\n blink"); Serial.print(i);
				delay(300);
			}
			delay(500);
			Serial.print("Blinked for ");
			Serial.print(count);
			Serial.print(" Times \n");
			delay(500);
		}
	}

Credits

Jeetranjan
JeetRanjan
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login