Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 81
511  Using Arduino / LEDs and Multiplexing / Solved TLC5940 library dependent on Serial? on: January 09, 2013, 05:10:16 pm
After much head banging and sarcastic but nevertheless encouraging/helpfull advice from friends, I finally used an Ohm meter and checked around the board. There are some shorts (and it isn't my soldering). One of them was shorting one of the LED outputs to the SIN - that explains a lot of the erratic behaviour.

In short - a hardware fault
512  Community / Exhibition / Gallery / Re: Arduino Snake Game 360 - Test Game on: January 07, 2013, 12:01:33 pm
Bummer. Playing the video it just says: "Unfortunatly this SME-music-content is not availbale in Germany, because GMEA has not granted the respective music publishing rights". I am sure the video is intresting.

OT comment: I can understand that the artist wants to earn his money, and that is fair enough. But this sell, resell and trading in copyright by 3rd parties with no "artistic interest" just is too much.
(So now I have to do some Ninja-trick with IP to see it anyhow. Well, I could)
513  Community / Bar Sport / Re: 30K ! on: January 07, 2013, 11:52:48 am
<tips his hat>
514  Using Arduino / LEDs and Multiplexing / Re: [Advice needed] Building a small BCD clock. on: January 07, 2013, 11:50:10 am
Nice, may I use it?
Of course, as long as you do not use it for nuclear powerstations, monitoring medical lifesupport, yada da da...
515  International / Scandinavia / Re: Hvor kan man købe Arduino Starter Kit? on: January 07, 2013, 09:50:25 am
Der er både Let-Elektronik og ElectroZone og RS-online. I min foretrukken rækkefølge. Der er flere, men mon ikke det er nok at begynde med smiley ?
516  Using Arduino / LEDs and Multiplexing / Re: TLC5940 library dependent on Serial? on: January 06, 2013, 04:51:59 pm
They are bright enough. I can not see any intensity difference after a few hundred. But the difference between 0 and 1 is very noticable.

I'll change the current limit resistor to something else - later.

Now I've got another problem. The "3rd" LEDs RED seems to be following pin 13. Apparently a short somewhere (I've swapped tlcs around, so it isnt a chip). Oh, BTW, this is the board.

Anyhow, the OP is still open, even though the "workaround" (calling update() often) solves the immediate problem.

I'm off for a few days travel, so I wont followup until back.
517  Using Arduino / LEDs and Multiplexing / Re: TLC5940 library dependent on Serial? on: January 06, 2013, 03:23:09 pm
I tried that, ie I had only the init() in the setup and the rest in the loop(), but only executed once. I posted the simpler version above. The documentation says one update() call pushes the array out to the TLCs.

But it made a difference.  smiley

So it seems one needs to call update() several times for the change to come through. Hmmm... while that solves my problem it does not explain why Serial should "rescue" it. (I'm using 1.0.3.)

This code fails, too, unless one activates the bottom Serial. I also fooled around with the number of times the update() is called and it needs 8 times. If I remove the Serial-"!" print it needs more than 20. Removing all Serial it requires more than 100.
Code:
void setup() {
  Tlc.init() ;
  Serial.begin(9600);
}

void loop() {
  static int R = 0 ;
  if ( R == 0 )  setchn() ;  // set up channles
  if ( R < 5 ) {Tlc.update() ; Serial.print("!") ; }
  if ( R < 10 ) R++ ;
  if ( R < 9 ) Serial.print(R);
}

void setchn() {
// load the current array
  for (byte C=0; C<=32; C +=16)   // for each colur
    for (byte n=0; n<16; n++) {  // for each element
      Tlc.set(WP[n]+C,32-n*2) ;   // load a value
      //Serial.print(".");
    }
}
518  Using Arduino / LEDs and Multiplexing / Solved TLC5940 library dependent on Serial? on: January 06, 2013, 02:07:05 pm
I am very confused. Just playing around with some simple code and some TLC5940s on a demo shield.

Code:
/* For the RGB 4x4 board, with 3 TLC5940 */

#include <Tlc5940.h>

const byte WP[] = // winding path
  { 0, 1, 2, 3, 7, 11, 15, 14, 10, 6, 5, 9, 13, 12, 8, 4 } ;

void setup() {
  Tlc.init() ;
  Serial.begin(9600);
  setchn() ;  // set up channles
  Tlc.update(); Serial.println("X"); // now send it out
}

void loop() {
}

void setchn() {
// load the current array
  for (byte C=0; C<=32; C +=16)   // for each colur
    for ( byte n=0; n<16; n++) {  // for each element
      Tlc.set(WP[n]+C,32-n*2) ;   // load a value
      Serial.print(".");     // comment out for code to fail??
    }
}
This works.

If the last line with Serial.print("."); is commented out, the LEDs remain dark. It is af the Tlc.set() is only called if the Serial is there.

I have discovered that if I change it from SPI mode to BitBang mode (#define DATA_TRANSFER_MODE) in the library I get even weirder results. I have a tiny "hello world"-like program which works without the Serial.

W-T-F ?? I just can't see my error.
519  Using Arduino / Programming Questions / Re: Can someone help me figure out what this loop is doing? on: January 06, 2013, 01:27:47 pm
A loop finishes on a false in the test condition. So it is looping until either 0x80 bit is false or it has tried 255 times. (As the && will be false if either term is false.)
520  International / Scandinavia / Re: RPM måler on: January 05, 2013, 04:59:17 pm
OK, så uden at nærlæse noget, dvs et hurtigt skud fra hoften, så skal du bruge samme logik med at se om du har skiftet til niveau "x" fra et andet niveau og kun udskrive (køre switch udsagnet) hvis det har skiftet siden sidst. Så noget á lá: (denne kode skrives uden stave kontrol - i øvrigt har jeg lige nydt et par juleøl  smiley-razz <smiley med julehat mangler her> )
Code:
if ( rpm >= 130 && lastState!=HURTIG)
   if (Pushcounter!=lastPushCounter) {
     lastPushcounter=PushCounter ;
     switch (PushCounter) {
 

Quote
skal motiverer børn til at motionere
Spænnende. (tænker at hvis man kunne arrangere at opladning af iPad/mobil KUN kunne foretages via en kondicykel ...)
521  International / Scandinavia / Re: RPM måler on: January 05, 2013, 01:19:31 pm
Den gøær præcis det du beder den om. smiley  I loop, gennemløber du din switch hver gang.

Men jeg kan ikke fra koden helt gætte hvad din hensigt er. Hvis du kun vil trigge den ved hver button up/down (hvis logik jeg ikke har nærlæst) så vil jeg foreslå du putter switch statement med tilbehør ud i en seperat procedure og kalder denne der hvor du skriver "PROFIL" og PROFIL:"

Ovenstående givet efter kort gennemgang - fejl og mangler kan forekomme - uden ansvar - bør ikke bruges til atomkrafteværker, kritiske medisinsk udstyr, eller fly sikkerheds udstyr smiley-wink

Msquare
522  Using Arduino / General Electronics / Re: Is arduino equiped with AC protection? on: December 30, 2012, 04:23:27 pm
When you write "AC protection" most people think of mains voltage (110-240V depending where you live). No, the Arduino has no protection against mains AC. It will simply emit a little cloud of magic blue smoke, possibly accompanied by a loud "pop".

You meant to ask if an AC signal (where the peak voltage is below 5.5V) on an input pin will damage it. No, no damage at all. It does not matter if it is a mixture of DC and AC. The problem is, can you get a usefull measurement?

On a digital pin, you will se the pin input change between HIGH and LOW at the frequency of the AC signal. If the signal is irregular it will switch just as irregularly, but be more often HIGH than LOW (due to how the digital input threshold is done.). On an analog pin you might expect the "DC average" over the time the port samples, but the way it does that, if the AC signal is in the tens-hundred-Khz range, you get essentialy a random value.

As others have said, if you want the DC component of your mixed signal put a capacitor in series and a resistor to ground, after your voltage divider, and you get some reasonable value for the DC part. Look up RC filters for usefull values. (The multimeter basically does this when you switch to AC measurement)

If the frequency of the AC is low enough you can measure the length of the AC periode on  a digital port. If it is real slow, you can sample often and get the wave form.
523  International / Scandinavia / Re: Arduino Uno + Easydriver + Stepper motor = Timelapse slide on: December 30, 2012, 03:17:39 pm
Tak for påskønnelsen. Og især en tilbagemeldning at det blev løst og hvad den faktiske fejl var. Det kan vi alle der læser forumet lære af og det går i bøtten med "fælles kendskab".
524  International / Scandinavia / Re: RPM måler on: December 30, 2012, 01:17:58 pm
Jeg forstår ikke hvad du vil gøre med din anden version med at test for hhv ==1 og >=20

I dit forrige eksempel fik du da en udskrift ved hver interrupt. (med den risiko at den tid du "hænger" i Serial.print - den tager jo den tid det tager ud udskrive - at rpmcount er imellemtiden nået til mere end 1) Der er dog den fejl at du laver en *(rpmcount-1) og da vi ved at rpmcount er 1 så ganger vi noget med 0. Det bruges oveni som dividend og da Arduino ikke er et fuldt OS sker der intet ved divide-by-zero - resultat er bare volapyk.

Brug lidt af hovedideen fra dit første forsøg: lav din test til >=1, tænk over at din udregning for rpm skal håndtere både at rpmcount er 1 og måske 2. Din konstant 60000 skal rettes. Default er tal i int og den kan som bekendt ikke blive mere end 32767. Put derfor et L bagved tallet så er det et long ("60000L") .
525  International / Scandinavia / Re: RPM måler on: December 29, 2012, 05:18:45 pm
Variabler der bruges i interrupts skal være volatile - det gør bl.a. at compileren ikke putter den midlertligt i et register. Jeg tror det løser dine problemer.

Dokumentationen nævner ikke at man også bør slå interrupts FRA mens man kigger på en multibyte variabel (som int). (Der er macro sei() og cli() - men brugen af dem er ... "tricky" )

Andre fejlkilder: Din magnetføler er vel "debounced" så vi ikke får flere hurtigt på hindanden følgende interrupts? Hvad hvis din main kode kommer bagud så du er forbi rpmcount==1?
Pages: 1 ... 33 34 [35] 36 37 ... 81