Posts by jcoffey
Pulsing LED is adjustable!
0Here is the second installment of Arduino projects.
This time I have jumped several stages and am giving you two types of functions, serial monitoring and schematics using tinycad.
As I worked with this sketch I found that using the input values and a millisecond delay made it way to long and interval to brighten and dim.
I changed to microsecond and used the analogRead value as the interval.
I also found that if the delay value became zero, delay behaved badly. To fix this I put a 330 ohm resistor on the ground side of the potentiometer so that the analogRead would never be zero.
You will notice some code left in that appears to be not needed. You are right! Some lines are left over from what I tried to do first;.
If the notes in the sketch are not clear please let me know in the comments. I have left out the video, for now
adjustable_PULSE_LED_schematic
/*
Pulse an led on a pin. Go from dark to full bright in an adjustable interval then back down to dark in the same interval. The interval is adjusted via a potentiometer.
*/
int ledPin = 11; // led pin used for LED in entire program
int sensorPin = 0; // pin pot is tied to
int interval = 1000; // interval for change in microsecond, 100000 is one second up and one second down
int sensor1 = 0; // sensor raw
int sensor1a = 0; // sensor expanded
int waitforit = (interval/255); //delay this much between each increment
void setup () {
Serial.begin(9600); //start serial comm
pinMode(ledPin, OUTPUT); //initialize ledPin for OUTPUT
pinMode(sensorPin, INPUT); // initialize sensorPin for INPUT
}
void loop() {
waitforit = readSensor(); //
/*
The Serial.print lines are a debugging aid printing out the value used to count up and down in the bright functions
*/
Serial.print(“waitforit is “);
Serial.println(waitforit, DEC);
brightup(); //call the brightup function to raise the led brightness from 0 to 255
brightdown(); //call the brightdown function to lower the led brightness from 255 to 0
}
/*****************************************************************************************
additional functions defined below
*****************************************************************************************/
int readSensor () {
/* This is the subroutine to read the potentiometer and return the value 0 – 1023
*/
sensor1 = analogRead(sensorPin); // read sensor
/*
The Serial.print lines are a debugging aid printing out the value read from the potentiometer
a 330 ohm resistor was added to the ground leg of the potentiometer as a current limiter and to disallow
a reading of “0″. Zero as a value for delayMicrosecond statement causes the loop to behave abnormally
*/
Serial.print(“Sensor1 is “);
Serial.println(sensor1, DEC);
sensor1a = sensor1 * 1; //stretch the interval out, if needed
sensor1a = sensor1a / 1 ; //divide value by a number for use as the count delay waitforit
return sensor1a; // return the adjusted value for the interval
}
void brightup () {
/* this is the subroutine to raise the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 0; brightness < 255; brightness ++){
analogWrite(ledPin,brightness); //write the brightness value
delayMicroseconds(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
void brightdown () {
/* this is the subroutine to lower the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 255; brightness > 0; brightness — ){
analogWrite(ledPin,brightness); //write the brightness value
delayMicroseconds(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
Arduino ho!!
0This will be my first post about arduino although not my first program. I waited until I had done some basic stuff and had something interesting to say.
I have done the blink and press button to blink. I decided the one to post about would be my venture into functions.
I needed to be able to call functions to allow for a program that had more flexibility to it. To that end I made what is a simple program to raise and lower the brightness of a led over a flexible period of time. I am going to post the program with what I hope are copious notes to make it understandable. If you have any trouble with it just leave a comment and I will try to clear the fog.
Here it is:
/*
Pulse an led on a pin. Go from dark to full bright in a designated interval then back down to dark in the same interval
*/
int ledPin = 11; // led pin used for LED in entire program
int interval = 500; // interval for change in milliseconds, 1000 is one second up and one second down
int waitforit = (interval/255); //delay this much between each increment
void brightup () {
/*
this is the subroutine to raise the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 0; brightness < 255; brightness ++){
analogWrite(ledPin,brightness); //write the brightness value
delay(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
void brightdown () {
/*
this is the subroutine to lower the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 255; brightness > 0; brightness — ){
analogWrite(ledPin,brightness); //write the brightness value
delay(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
void setup () {
pinMode(ledPin, OUTPUT); //initialize ledPin for OUTPUT
}
void loop() {
brightup(); //call the brightup fuction to raise the led brightness from 0 to 255
brightdown(); //call the brightdown fuction to lower the led brightness from 255 to 0
}
This is it working
Your password is what!!?
0
We all do it, it’s easy. You don’t want to remember a dozen passwords so you just makeup a simple one and use everywhere. It’s no big deal, until a service you use that was not important is hacked and the “one” password is now exposed and is fed to a bot that will try every possible bank and service to see what they can get.
Another common mistake is choosing names in your life, past or present for the password or reset questions. That was the mistake Sarah Palin made.
There is also the rule method. With this method you devise a formula and use it to make a self recoverable password. The simplest example is the all ways fun igpay atinlay. As with all things that can be made by a plan they can be undone. There is no simple way to make a robust password plan. It will require variety, random choices and lies.
One plan could be to create a tier of passwords:
- Highly secure with eight or more characters including numbers and capitals like fFer55$5$ERTGgH. Use these with banks and sites that can affect your life directly.
- Moderately secure with eight or more characters. A pass phrase is good here like, supercalifragilisticexpealidocious. Use this for sites that you pay to use and may have your credit cards attached.
- Moderately secure with just eight characters. for example MoonBeam. Use this with sites that you access for information but can’t purchase items or send email on your behalf.
The More passwords you have the better though. To that end I use a service called LastPass. There are other services and the browsers them selves can store passwords. LastPass has plugins and extensions for Chrome, Firefox and a tabbed browser for IOS that make it a better choice for me.. They have a free version and a paid version with more services. I current use the free version. It will save the password for any site and fill in the username and password fields when you go to each site. They also has a password generator that can create a random password of long length for your protection.
Cloud printing for the poor
2I was going through my chrome options this morning, trying to find a way to reduce the visible size of the app screen and found “cloud printing”?
This feature showed up in Chrome v9 apperently, I just didn’t notice. So I set it up and checked to see if I could print from my ipad to the desktop printer. It worked! I can even print from my iPod touch on IOS 4.2
Setting up was a breeze. Just click on the wrench and go to options then the under the hood tab. Sign in to “Cloud print” and your off.
I tested it with my iPad and Google docs. I tried two different docs and both printed just as they should. You are offered a choice of printers, based on what you have installed on the computer.
Currently the spreadsheet did not offer a cloud print choice.
I then used team viewer to setup cloud printing on a home computer with a printer and WOW. There is the printer at home. I could be anywhere and send a print-job to a printer at work or at home!
This is just one more reason to use chrome and Google docs for your word processing needs.
Secret messages: no lemon juice needed.
0I have found an extension for chrome called encrypt the cloud. It allows you to post encrypted message to twitter,face book and several other sites, encrypt them and decrypt the replies or posts from your secretive friends. You can get it at the chrome web store. Once installed you just add your name and key and the name and key of your secret friends. you may also have to add each site you wish to encode/decode.
On twitter just type your tweet, hit ctrl-y and there you are. It does take up extra room so it will mean less information or more abbreviations. you can also use the dem pasge to encrypt a message for general posting with clear text or an un supported site.
Give it a try. my ussername is thetwidgetlog and key is starbuck.
{{thetwidgetlog::YJdVTu3 t7e157w XQYlrc4 4CYlmps V8oxYnl OJ6boAy HbxZaXQ d8ivOGi /sub0Sy NYQa8My 6YRXuiJ TNIkGnX KarXP0A wXcNE8T baB5ALs Kq7AOsc E95iqeo /B9TQ0f uloIpk4 4zERkUE PVh02D4 48N0l/K rxAEWRi 1a0}}