Show Posts
Pages: [1] 2 3 ... 302
1  Using Arduino / Programming Questions / Re: HELP on PWM programmed on: Today at 03:28:58 pm
Regular leds are bright at 20 mA and you want to wire leds for 12V in parallel with a resistor each, when 1 does quit it won't kill the whole line like some old string of tree lights.
1 PWM to 1 FET can run the lot efficiently but if you're Larry The Cable Guy then you won't figure it out.

2  Community / Bar Sport / Re: ship in a bottle 3D printer on: April 19, 2014, 07:38:42 pm
All the 3D-printers I've seen have a build platform though for PLA it doesn't have to be heated.
3  Community / Bar Sport / Re: Your latest purchase on: April 19, 2014, 07:27:14 pm
So I got my $17 + $2-something shipping PJRC Teensy 3.1 quick from OSH Park only to find that I don't have a cable for the USB micro-B jack on the Teensy 3.1.

Correction. Didn't have a Cable.
Got a pack of 4 Samsung phone charge and data cables (in different bright colors) for $4-something. They work.
Gave the pink one to my friend who likes pink things. Made a bet that her g-daughter will have it by next week.

The Teensy 3.1 works and programs fine though setup was not decision-free but installing Arduino 1.05 fixed that as the needed latest version of Teensyduino is not supported by 1.03 that I've been using.

It's alive! And you can get USB A to micro-B cables cheap through Amazon if you have or know someone with Prime (free 2-day from when the order is sent shipping). You might match that on eBay or elsewhere. The thing is that I had to look in a USB phone cable type category to find that deal at all.
4  Using Arduino / Programming Questions / Re: Having trouble "inserting" new characters to a String object. on: April 19, 2014, 06:49:37 am
Whitespace is ignored by the compiler, the spaces are through style to draw some emphasis notice or clarity on any particular use of the * but read it as if there are no spaces.

char *cptr = "buffer"; // 7 bytes get allocated that cptr now points to

*cptr = 66; // this puts the value 66, ASCII 'B' over the 'b' in "buffer".

char newChar = *cptr; // now newChar == 66, not the address in cptr itself. * accesses the contents at the address.

Practice or you'll lose what you learned.



5  Using Arduino / Programming Questions / Re: Sketch on Mini w/328 only runs once on: April 19, 2014, 06:31:09 am
How many volts and amps are you feeding it after you program it?
6  Using Arduino / Programming Questions / Re: Sketch on Mini w/328 only runs once on: April 19, 2014, 02:44:58 am
You should know by the compiler output messages below the code window when you download.
7  Using Arduino / Programming Questions / Re: Where am I going wrong with the no delay method? on: April 18, 2014, 07:03:41 pm
Nick Gammon's explanation includes blocking code and how to avoid it, with example code:
http://www.gammon.com.au/forum/?id=11411

Quote
This question comes up practically every day on the Arduino forum - "how do I blink two LEDs at different rates?" or "how do I turn on and off two motors at different times?".

Quote
Let's look at an analogy. Say you want to cook breakfast. You need to cook:


    Coffee - takes 1 minute
    Bacon - takes 2 minutes
    Eggs - takes 3 minutes




Now a seasoned cook would NOT do this:


    Put coffee on. Stare at watch until 1 minute has elapsed. Pour coffee.
    Cook bacon. Stare at watch until 2 minutes have elapsed. Serve bacon.
    Fry eggs. Stare at watch until 3 minutes have elapsed. Serve eggs.



The flaw in this is that whichever way you do it, something is going to be cooked too early (and get cold).

In computer terminology this is blocking. That is, you don't do anything else until the one task at hand is over.

What you are likely to do is this:


    Start frying eggs. Look at watch and note the time.
    Glance at watch from time to time. When one minute is up then ...
    Start cooking bacon. Look at watch and note the time.
    Glance at watch from time to time. When another minute is up then ...
    Put coffee on. Look at watch and note the time.
    When 3 minutes are up, everything is cooked. Serve it all up.



In computer terminology this is non-blocking. That is, keep doing other things while you wait for time to be up.

8  Using Arduino / Programming Questions / Re: Calculating slope using array issues on: April 18, 2014, 06:56:21 pm
And when the shaft stops turning and delta-displacement is zero your numbers go to?
9  Using Arduino / Programming Questions / Re: Sketch on Mini w/328 only runs once on: April 18, 2014, 06:52:44 pm
Too bad.

Are you sure the sketch copies?
10  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 18, 2014, 06:37:44 pm
They use some kind of packet system with its own ECC?
11  Using Arduino / Programming Questions / Re: Where am I going wrong with the no delay method? on: April 18, 2014, 11:10:32 am
in your void flash, instead of
Code:
interval = analogRead(0)/10; //read pot value, divide by 10 to reduce range of flash sweep speed
  if (interval <5) // delays of less that 5 create too fast of a flash sweep. Set to minimum of 5
  {
    interval = 5;
  }
you could maybe map the value, like this you can easily control it's min and max values. No need for that if statement.

You do know that min and max use the same basic code if not more?
12  Using Arduino / Programming Questions / Re: Calculating slope using array issues on: April 18, 2014, 11:07:36 am
I should have taken more time on that.
13  Using Arduino / Programming Questions / Re: Sketch on Mini w/328 only runs once on: April 18, 2014, 11:05:09 am
Quote
You do know that the Mini may have some differences as to pin numbers (and is there a led?) from say, the UNO?
No it doesn't. It's the same 328P chip. Only difference is that some promini's support A6/A as analog inputs.


My UNO board has a pin map just to tell board pins from 328 pins.

Does the Mini have the built-in led and resistor on pin 13?
14  Using Arduino / Programming Questions / Re: Where am I going wrong with the no delay method? on: April 18, 2014, 11:01:19 am
If you use unsigned integers then the only accounting for rollover is that you have a maximum longest interval regardless of when it starts.

Unsigned integer rollover requires no difference in code when you handle it properly in the first place.

if ( Unsigned_Now - Unsigned_Start >= Unsigned_Interval ) {}; // ALWAYS WORKS REGARDLESS OF ROLLOVER

The only times you need "rollover code" is when you don't do the unsigned subtraction or you don't use unsigned math (or manage to klutz it up in some more convoluted way).
15  Using Arduino / Programming Questions / Re: Sketch on Mini w/328 only runs once on: April 18, 2014, 10:52:27 am
You do know that the Mini may have some differences as to pin numbers (and is there a led?) from say, the UNO?
http://arduino.cc/en/Main/ArduinoBoardMini

If you can't get this sketch to run it may be due to those very differences:
Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);   
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

There could be power issues for all I know.
Pages: [1] 2 3 ... 302