Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 91
121  Using Arduino / Programming Questions / Re: Help increment/deincrement push buttons? on: March 12, 2014, 07:50:38 pm
If you need to stay within some boundaries, you should program those.
After debouncing a key press, you should do what that key press is meant to do.
Immediately after that you should check to see that took you beyond your boundaries.
So something like this:
     if (buttonState5 == HIGH)
      if (buttonPushCounter > 127) {        // This is new
        buttonPushCounter = 127;            // So is this

When printing, you should erase all characters you have printed last.
So if you go down from 100 (3 characters wide) and you print 99 without erasing the old content first, you'll end up with a 990 displayed (so not 999).
To get rid of that, you should print 3 spaces, which was what johnwasser told.
There isn't much more to it.

2 AM, bedtime is long due.
Maybe i'll have some other thoughts after some sleep.
122  Community / Bar Sport / Re: List of all the 'ranks'? on: March 12, 2014, 06:09:10 pm
Do you mean this page ?
That still seems to work OK to me and i think it's very useful.
123  Community / Bar Sport / Re: whats with the attitude on: March 12, 2014, 05:54:50 pm
Where is the attitude ?

And how about this for an attitude:
So spank me and send me to bed without dinner. What does this have to do with my question!

Why are you so hypersensitive to answers you weren't expecting, but are without any doubt true and correct (helping) answers ?
By the way, did you see the link in the page you linked to ?
And did you see there that you aren't providing a str, but a pointer to it ?
I don't know anything about that yet as i haven't been playing with that.
But you might like to have a look at it.
Back on topic now.
124  Using Arduino / LEDs and Multiplexing / Re: led strobe without delays help? on: March 12, 2014, 05:27:48 pm
OK, some progress is made, so well done.
You'll get this done before next weekend if you stay at this rate.

You have now changed blink without delay in such way you think it can handle more than 2 states: on and off for a fixed time.
This is almost true, but you are missing 2 important steps.
The first one is that you forgot to keep track of what interval number you are working on at that moment.
The second one is that you are always, in every iteration, updating previousMillis to currentMillis, you really don't want to do that.
You only should update that if some requirements are met.

Tip: Find out what these curly braces { } are about, and why some people argue about two of them being at the same line.

By the way, i would not check the smallest number first.
If you check the largest number first, if that isn't met the second largest number and so on, you don't need my first step above.
So you don't need to keep track of an interval number and you will save some memory.
Not important at the moment but this will be in future code.

Sorry that last part is incorrect.
In this case, one found value doesn't mean the other values are not true.
So when you are looking for interval4, interval3 will trigger in case you have a value of 600.
That would prevent you from ever reaching interval4.
Therefore, you should keep track of at what interval you are working at the moment and create another variable for that..
125  General Category / General Discussion / Re: Arduino Tinkerkit on: March 11, 2014, 05:33:10 pm
Hi Sharkfin, and welcome to this community.

Dannable is right, this kit doesn't include the Uno and it is expensive at € 119.85 (converted by Google).
The kit is offered at € 69.90 from the Arduino site, but you need to add VAT to that (i doubt that will add over 70 %).
By the way, both say they're out of stock now.

If you do not yet have an Arduino, you might want to consider the starter kit.
It costs 10 more euro's, which would be some 8.35 pounds.
It does have an Uno and a project book.
It doesn't have modules like the tinkerkit but it does have an LCD screen, a servo and a small motor, some sensors.
So you can work with light, sounds and movement.

Sorry for making this a harder decision to you.
126  Using Arduino / LEDs and Multiplexing / Re: led strobe without delays help? on: March 11, 2014, 04:57:58 pm

You need to keep track of what you're doing and have been doing.
You also need to ask yourself if you really need to use that extra function (void strobeflash() ), but in this case that doesn't really matter.

Keeping track of what you're doing requires some extra variables.
This variable is a flag that tells you in what state you are, and this approach is also known as a state machine (you can and should do some research on that).
It will allow you to skip or do some part of your code, depending on a decision that was made earlier.
In this case, the lapse of strobetimer should trigger some flag, and that flag (together with strobetimer itself) should also be reset at some place in your sketch.

There is absolutely no difference to the blink without delay sketch here.
Try to build code and show it.
There will be someone that tells you where you're doing the right thing and where not.
You will only learn by doing, make mistakes and understand those mistakes.
127  International / Nederlands / Re: logging en pulsenteller on: March 11, 2014, 01:08:10 pm
Beste Ben, welkom op het forum.

Omdat dit voor een schoolopdracht is, is het de bedoeling dat je dit zelf doet.
We zijn ons er hier erg van bewust dat hier vaak gezocht word naar oplossingen voor schoolopdrachten, en daarom is de kans heel klein dat iemand je gaat voordoen wat je moet doen.
Niet dat ik dat in je vraag lees, maar puur voor de duidelijkheid.

Je vertelt hier niet wat je probleem is, ook niet wat je opdracht precies behelst, en niet wat je wil meten.
Alleen dat je 'iets' moet doen met 3 analoge ingangen (waarom zijn dat er 3 en geen 5 ofzo ?) en een pulsingang.

Ik heb wel een tipje voor je.
Het forum kan doorzocht worden met gebruik van Google.
Helemaal rechts boven in het scherm kun je zoeken (het vakje is wellicht wat lastig te zien want weinig kleurverschil).
Als je gaat zoeken, moet je een slimme zoekterm gebruiken en das er eentje waarvan je mag verwachten dat die niet in ieder onderwerp voor zal komen.
Zoeken naar "sketch" of "code" is dus niet handig.
Maar je hebt het woord "trapas" al in de virtuele mond genomen.
En wie weet is er ook nog iets te vinden met het woord "fiets".
Beide zijn wel Nederlandstalige woorden, dus als je iets gaat vinden zal dat onwaarschijnlijk in een andere taal zijn.
En ze hebben ook erg weinig met Arduino, maar wie weet wat je gaat vinden..
(ik dus wel :p)
128  Using Arduino / LEDs and Multiplexing / Re: led strobe without delays help? on: March 10, 2014, 05:26:53 pm

Posted a lot on your first day (haven't seen the other posts yet).
But still, slow down.

Let me ask you first to read this (click !).
It is on top in every part of the forum, and tells you how to use it.
Don't think you know all that, just read it once or twice and use the information.

So next time you post some code, put it in code tags like this:[code] put it here [/code].

Your code can't be right.
You are trying to work with something that constantly changes (time), but you are assigning constants to it, even though you do not define them as such.

void setup()   {              
  // initialize outputs:
  pinMode(ledPin9, OUTPUT);
  strobetimer = millis ();
  strobetime1=millis();   // set time as now
  strobetime2=millis()+30; //first strobe duration
  strobetime3=millis()+100;   // short wait
  strobetime4=millis()+150; //second strobe duration
  strobetime5 = 1000; //long wait
This is effectively assigning constants.
Setup is only run once.
Read millis() as "now".
Then you set strobetime1 to now, exaclty like you described.
And strobetime2 to now (a fraction later than the now in strobetime1) + 30 milliseconds
And so on.

Then you are checking to see some things are true, but at least after the first iteration they are always true.
void strobeflash ()  {

    // Strobe Sequence :
 //   strobetime1=millis();   // set time as now

    if(millis()>strobetime1) // first strobe flash
      digitalWrite(ledPin9, HIGH);   // set the LED on
    if(millis()>strobetime2) // short wait
      digitalWrite(ledPin9, LOW);    // set the LED off
    if(millis()>strobetime3) // second strobe flash
      digitalWrite(ledPin9, HIGH);   // set the LED on
    if(millis()>strobetime4) // end of second flash
      digitalWrite(ledPin9, LOW);    // set the LED off

The short wait might be an actual wait only the first iteration, after that millis will for sure always be > strobetime2
So your sketch can't do what you expect it to do.

What you might want to do, is this:
 strobetime1=millis();   // set time as now
  const long strobetime2=30;     //first strobe duration
  const long strobetime3=100;   // short wait
  const long strobetime4=150;   //second strobe duration
  const long strobetime5 = 1000; //long wait
And then check to see what timers have elapsed by comparing them to a variable that was set by millis() when strobeinterval lapsed.
Because you are comparing to a long (millis()), you should use a long here too.

Study blink without delay some more.
129  Using Arduino / General Electronics / Re: why I need resistors on: March 10, 2014, 04:49:57 pm
Hi mike007, and welcome.

Lots of comments to your question here.
But don't think you asked a dumb question, there's only 1 dumb question and that is the one that was never asked.
Resistors and some other 'basic' components have multiple uses.
Therefore your question can't be answered like that.
Fellow countryman nicoverduin tried to explain a bit, and LarryD showed some links that in turn show a bit of the diversity of usefulness of resistors (and that's not all there is by far).
Besides resistance, voltage and current, there is more to keep in mind like maximum power (some call this "wattage") and voltage a resistor can withstand.
Sometimes even inductance.
But still resistance, voltage and current are the first things you need to understand.

So you should always put these questions in a context.
If you have a question about some resistor in a specific setup, ask and tell about that setup.
That will make it easier to explain to some and the replies easier to understand for the others.
130  General Category / General Discussion / Re: testing something on: March 10, 2014, 02:08:49 am
I know how to use code tags.

Is there a way that I can have
[ code ] and [ /code ]
but without the spaces
in a post?
(To trick the html/bb editor like?)

If there is a code tags sticky somewhere, point me to that.

In my post i did show a line containing code tags without spaces.

[code]There's no spaces here[/code]

If this isn't it, sorry for not understanding what else you're asking for.
This is where you can get some information about SMF codes.
131  General Category / General Discussion / Re: testing something on: March 09, 2014, 06:33:31 pm
Some forum software have the noparse tags.
Using these tags, let you write any tags except for the noparse tags themselves.
This SMF software has a similar function, but it's called nobbc (Bulletin Board Code)
So you would put [ nobbc] and [/nobbc] without spaces around the codes you want to show.
Is this what you were looking for ?
132  Using Arduino / Displays / Re: hello need help with coding for 2.8" TFT touch srceen on: March 09, 2014, 06:19:56 pm

First of all, there is no question in your post.
Do you have any questions, or would you like us to see how you are getting along building this code ?
Second, code is supposed to be put in code tags.
You can do so by clicking the # button above the edit field, and then paste your code.
That will make the text better legible and prevents unwanted formatting of the text you're pasting.

You can certainly use multiple if...else statements in your code.
You can also consider using, i like that one very much.
133  Using Arduino / Displays / Re: Problem with SSD1306 LCD and U8glib on: March 09, 2014, 06:45:01 am
I agree that this forms a solution and that one can use the display ans U8glib as is from now on.
But i really like it when things like these can be solved, and with the example i have here, this can be solved.
You might very well be right that reducing production cost has lead to allowing just inbound data for this module.

The signals on these pins 19 and 20 are data in for pin 19 and data out for 20.
If you connect pins 19 and 20 by shorting them with some solder, you will have 2 direction I2C from the display.
This is an easy job because those pins are close enough to each other, but a magnifying glass might come in handy.
I can't tell whether the module will prohibit 2 way communication or not.
134  Using Arduino / Displays / Re: Problem with SSD1306 LCD and U8glib on: March 09, 2014, 04:53:48 am
If it doesn't send that acknowledge bit, does it send any thing at all ?
This seems to be the same display (it is available in white, blue and blue/yellow) as fitted on the Crius CO-16.
Are pins 19 and 20 of the flex cable from the display connected ?
If not it can't send anything back and that can be solved by connecting these pins with a drop of solder, which is easy to do.
After that, the display will work as it's meant to be.
135  Using Arduino / Displays / Re: 20x4 LCD + "1602" I2C backplane - Working ? on: March 08, 2014, 03:56:58 am
Yes, it should.
You need to tell your sketch that you have a 2004 instead of a 1602, and that's about all there is to it, as for differences between those displays.

You have to figure out what pins are connected at that backpack.
Doing so before soldering the backpack to the display will make this an easy job.
Once you found out what pins of the chip are connected to what pins to the display, you'll be able to set the constructor in your sketch.
But if you have some working sketch for this module that controls a 1602, then you will be fine telling it it in now a 2004.
Ebay seller doesn't seem to care for sharing any details on this product for that buck and a half.
Pages: 1 ... 7 8 [9] 10 11 ... 91