Flash_BRIGHT

Flash_BRIGHT © GPL3+

Why you can blank, void setup()

  • 211 views
  • 0 comments
  • 1 respect

Components and supplies

About this project

I am a creative Arduino novice and have a desire to build experiments using a number of different boards in a line. Some people believe you cannot connect more than two Arduinos, I want to find out if, in fact, we can link as many as we wish - but am not able to 'run', so am walking, at the moment.

I realised very quickly that when only one LED at a time is flashing I don't need to connect a resistor to each LED, but need only one, if I connect it via -ve/GRD. Saves clutter, work and resistors.

I had in the back of my mind that writing ten int statements at the beginning seemed to be repeated in my for loop, and why did I need to do that?

I had noted that that's what everyone does, but was it just 'usual practice', or not, actually, necessary.

So, when I built this project, a well known circuit (except I changed the resistor sequence), I got one BRIGHT flashing LED and nine almost invisible ones, for reasons I still do not fully understand, since they were obviously getting a voltage, but much less than the expected 5v.

The project photo demonstrates the dim(top LEDs) and BRIGHT LED qualities.

Still loath to just write in the other nine int statements, I spent hours over three days before I was sure it was not hardware related - like duff LEDs.

Then I spent hours on the last day trying to work the software - still did not want to write in those pesky int statements..

Eventually, I decided to see if void setup() is absolutely needed and just deleted it. Of course, it did not work at all, since it is a requirement.

In the back of my mind was a possible fix, but, after experimenting, it meant me declaring the pinMode(pin, OUTPUT); instruction in both setup and loop functions. In fact, a bit of experimenting proved that I could leave void setup() entirely empty, so I needed only to declare it once inside the void loop() function.

So I wrote:

void setup() {}

Which Verify proved is acceptable.

Now all the LEDs flash BRIGHT, instead of one bright and nine dim..

Q. Does anyone know why a low voltage between 0v and 5v happens when you choose not to put the other 9 int declarations at the beginning?

23rd March 2019 (updated)

[

I have created the 'Dohmino 1 (ONE)' device which proved to me that it is possible to connect unlimited numbers of any types of Arduino together, safely. I call it a Dohmino because I was originally thinking to link them in a "domino effect". I wanted a slight variation so people would have a name to put with it. Then I realised I could just put the 'h' in it so it is a doh sound, like dote, instead of a do', like in dot. It also happens to contain three letters of my surname, cool, but just a coincidence, really.

Do you remember that Star Wars film sequence where R2D2 pokes a sensor into the prison info and finds where Princess Leia is? The dohmino system would allow you to mimic that, swapping information between two or more devices with no wired connections. So it is wi-fi, "but not as we know it".

I have only linked two Arduino UNOs, so far, but am awaiting more parts to create more perf-boarded dohmino1 setups [See bottom right of the above image for the latest, Dohmino1, perf-board prototype].

The principle of linking multiple Arduinos is the same, though, and I should eventually be able to set up Dohmino links with six Arduinos: UNO / UNO/ MEGA / UNO / MEGA / UNO in sequence.

Although I would like to link at least five boards, being a novice will probably mean that I will need some help soon, so I will, at some point, take the advice of the Arduino Team and put out how this works into the Forum.

Recently I discovered something very interesting about another well known device that was a surprise.

If and when I succeed with Dohmino 1, there may be a Dohmino 2 test up and coming. If it works , there would then be two methods of making Dohminos. The Dohmino2, however, will probably be significantly faster.

]

Code

flash_Bright_01Arduino
Learning project, why you can blank void setup()
// Created 8th February 2019 by Neil Doherty
// instead of making eleven int statements, only two are used.

int pin = 0;
const int delayPeriod = 30; // uses less memory than int.

/* by creating void setup() as an empty statement, I think we save space in the Arduino memory by using the lowest possible number of int statements, because they are not in the program twice, which also enables the LEDs to Flash BRIGHT, instead of 'glinting'.
*/
void setup() {}

void loop() {

 for (int pin = 4; pin < 14; pin++)
  {
    pinMode(pin, OUTPUT); // declare pinMode once in the loop, here.
    digitalWrite(pin, HIGH);
    delay(delayPeriod);
    digitalWrite(pin, LOW);
    delay(delayPeriod);
  }
     for (int pin = 13; pin >  5; pin--) // 13 and 5 used here so that
     // the outer LEDs are not double-flashed unnecessarily
  {
    digitalWrite(pin, HIGH);
    delay(delayPeriod);
    digitalWrite(pin, LOW);
    delay(delayPeriod);
  }
}

  

Schematics

flash BRIGHT
An image of an easy to copy circuit.
Flash bright i4t91hecva

Comments

Author

Zigster
Zigster
  • 0 projects
  • 1 follower

Additional contributors

  • General learning by Broadcast knowledge

Published on

February 8, 2019

Members who respect this project

Saulofilho
See similar projects
you might like

Similar projects you might like

Programming 8x8 LED Matrix

by SAnwandter1

  • 146,839 views
  • 31 comments
  • 137 respects

Programming 4 Digit 7 Segment LED Display

by SAnwandter1

  • 94,843 views
  • 30 comments
  • 78 respects

10 Awesome Beginner Arduino Projects

by RoyTobby

  • 106,497 views
  • 1 comment
  • 30 respects

NeoPixel LEDs: Arduino Basics

by Alex Glow

  • 44,362 views
  • 1 comment
  • 48 respects

Buzzer Alarm System With Help Of Arduino

by ONYX

  • 43,784 views
  • 6 comments
  • 24 respects

Control your Light System Using Smart Phone

Project tutorial by Ahmed Yassin

  • 35,262 views
  • 4 comments
  • 55 respects
Add projectSign up / Login