Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Attiny refuses to Multiply (highlowtech.org core) on: April 04, 2014, 04:09:51 pm
Yep,

found out that the damn ld file is inside tools-universal.zip inside https://github.com/arduino/Arduino/blob/master/build/macosx/dist/


Im gonna try build it from the source and see if that version works (i doubt it '3 years ago Updating to avrdude 5.11 on Mac OS X.')

if dosen't work
then im gonna fork the damn thing and apply the ld file inside the zip and build it... might try to submit a patch then... or just use my forked one.. i don't intend to use 1.5 while still beta..



2  Using Arduino / Programming Questions / Re: Attiny refuses to Multiply (highlowtech.org core) on: April 04, 2014, 03:40:27 pm
Thank you dear Moderator,

Found exactly the problem at
http://forum.arduino.cc/index.php?topic=116674.0#msg881917

didn't try the fix yet, but yes it only happens on macs, just compiled the sketch on a Linux box and works fine...

So the problem is in the arduino for mac itself?
3  Using Arduino / Programming Questions / Re: Attiny refuses to Multiply on: April 04, 2014, 02:36:01 pm
You are right, i might add something to just dont do nothing if that occurs smiley

Thanks
4  Using Arduino / Programming Questions / Re: Attiny refuses to Multiply on: April 04, 2014, 02:28:18 pm
PaulS,

the greyDiff wont get 0 or below, because of the values that are read from the analog port...

anyway, i found a solution....

my sketch size was 5.404 bytes (max on attiny is 8.192)

And i noticed that all started when i changed the core to highlowtech.org to use software serial (only need tx)

So, i tried to change from SoftwareSerial to TinyDebugSerial using arduino-tiny library from code.google

Now im running my old code line the one that started the error
Code:
colourArray[i] = (colourArray[i] - blackArray[i]) / (greyDiff *255) ;

The result is that, all works fine now and the sketch size is 3.874 bytes.

I still believe the problem is within the core of attinys highlowtech.org implementation, and i also opened a issue there https://github.com/damellis/attiny/issues/46
5  Using Arduino / Programming Questions / Re: Attiny refuses to Multiply on: April 04, 2014, 07:25:50 am
PaulS, thanks for the reply!

Look what i've done and still have the error:

Code:
float greyDiff = whiteArray[i] - blackArray[i];
float temp =  greyDiff * 255.0;
float temp2 = colourArray[i] - blackArray[i];
colourArray[i] = temp2 / temp;

Cant break the code simpler than that!
if i comment the last line "colourArray = temp2 / temp;"
it compiles fine!
 
even if i set a float variable for the 255, still gives the same error.

Im blaming attiny because it works fine on Uno or NANO. (if i change the board, works fine!!)
I am no genius, i might be doing something wrong but i cant figure out!

Thanks again!
6  Using Arduino / Programming Questions / Attiny refuses to Multiply (highlowtech.org core) on: April 04, 2014, 06:59:11 am
Guys, im having the weirdest problem ever...

I programming a attiny using this core http://highlowtech.org/?p=1695 (so i can use SoftwareSerial) and using a Arduino 1.0.5 IDE
I set the board to Attiny85 (internal 8mhz)
The problem is with this line
Code:
colourArray[i] = (colourArray[i] - blackArray[i])/ (greyDiff * 255)

Here are the variable declarations
Code:
float colourArray[] = {0,0,0};
float whiteArray[] = {0,0,0};
float blackArray[] = {0,0,0};
float greyDiff = whiteArray[i] - blackArray[i];

The problem is exactly with the * 255, if i remove it, it works (in fact if i change 255 to 5 it still gives me the erros, but if i change to 1 or 2, it works)

here is the error:
Code:
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25/libgcc.a(_exit.o)

btw.. it works fine on arduino nano or uno. so ive got to be something with the attiny!

well, just some headsup, i did try a few changes but still the same, now i dosent dive temp2 / temp if the * 255 is there

Code:
float temp = 255 * greyDiff;
     float temp2 = colourArray[i] - blackArray[i];
     colourArray[i] = temp2 / temp


Tkz for the help guys! and keep the community alive smiley
7  Using Arduino / LEDs and Multiplexing / TLC5940 + VirtualWire, problems on: October 14, 2013, 09:29:45 am
Hello all,

Im using RF to talk betweeen two arduinos, to light up some leds using TLC5940.

the RF Part is ok, the server send the data and the receiver receives it and display in my serial output

Then i merged the TLC stuff with the receiver.

Then i got a problem, the TLC overwrites the VirtualWire.

I changed the ports on TLC
BLANK -> PB2 (D10)
XLAT -> PB1 (D9)
SIN -> PD7 (D7)
XERR -> PD6 (D6)
SCLK -> PD4 (D4)
GSCLK -> PD3 (D3)

Edited the tlc_config.h  and setted
#define DATA_TRANSFER_MODE TLC_BITBANG

Then switched the virtualwires to tx 0, rx 1 then rx to 8, but any case the problem remains the same

When i upload the scketch, commenting the TLC.init(), the virtualwire works fine, but if i leave uncommented the virtualwire stops receiving the data.

The tlc is working fine, just overrinding, or messing with the virtualwire.

Im attaching the source, but dunno if it will help.

any thoughts? Thanks for the help!

Code:
#include "Tlc5940.h"
#include <VirtualWire.h>

int pinR[12] = {0,3,6,9,12,15,18,21,24,27,30,33};
int pinG[12] = {1,4,7,10,13,16,19,22,25,28,31,34};
int pinB[12] = {2,5,8,11,14,17,20,23,26,29,32,35};

int hourForecast[12] = {10,11,10,11,10,10,10,10,11,10,10,10};

char dados[] =  "110212011301140115031603170318021902200221012201";

void setup() {
  Serial.begin(9600);
  Serial.println("setup");
 
  //VirtualWire
  vw_set_tx_pin(0);
  vw_set_rx_pin(8);
  vw_setup(2000); // Bits per sec
  vw_rx_start();
 
  Tlc.init();

}

void loop() {
 
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
int i;

        //digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");

       
//char dados[i];
for (i = 0; i < 47; i++)
{
 
            dados[i] = buf[i];
   
}
        Serial.print(dados);   
Serial.println("");
        //digitalWrite(13, false);
       
       
    }
 
  //setForecast();
  //setLights();
 
}

void setForecast(){
 
   for(int i = 0; i <= 44; i = i+4){
    int hora = (String(dados[i]).toInt()*10 )+  (String(dados[i+1]).toInt());
    int dado = (String(dados[i+2]).toInt()*10 )+  (String(dados[i+3]).toInt());
   
   if(hora >= 12){
     hora = hora - 12;
   }
   
    hourForecast[hora] = dado;
  }
}

void setLights(){
Tlc.clear();
  for(int i=0; i <= 11; i++){
   
    //Serial.print(i);
    //Serial.print("-");
    //Serial.println(hourForecast[i]);
   
    if(hourForecast[i] >= 1 && hourForecast[i] <=2){
      Tlc.set(pinR[i], ((4095 * 255) / 255));
      Tlc.set(pinG[i], ((4095 * 255) / 255));
      Tlc.set(pinB[i], ((4095 * 0) / 255));
    } else if(hourForecast[i] >= 3 && hourForecast[i] <=6){
     Tlc.set(pinR[i], ((4095 * 102) / 255));
     Tlc.set(pinG[i], ((4095 * 255) / 255));
     Tlc.set(pinB[i], ((4095 * 255) / 255));
    }
   
   
  }
  Tlc.update();
  delay(5000);
}
8  Using Arduino / Networking, Protocols, and Devices / SainSmart WiFi Shield doesnt work on: August 13, 2013, 10:04:27 am
Guys,

 i need help smiley ive bought the SainSmart WiFi Shield, but i never been able to use it smiley-sad

http://www.sainsmart.com/sainsmart-wifi-shield-802-11b-g-for-arduino-mega-uno-duemilanove.html

Ok, i can get the WIZSmartScript, and configure to access my route, my other pcs can ping the damn thing....

But what i need, is just put it in arduino, and transmit some sensors data to a website, simple webclient stuff..

i tried the https://github.com/Wiznet/WizFiShield/

but every example gives me the sync data timeout smiley-sad



Any ideias please? Im stuck smiley-sad
9  Using Arduino / LEDs and Multiplexing / Re: TLC5940, cant fade more than 12 pins at the same time? on: August 07, 2013, 06:08:31 am
Thanks john!! works great!

now im with another problem hehe... how the heck can i realize that the fade stoped (like 1 fade) then make it do another thing, like stay still, or do another fade in another pins?

the only problem is that i cant figure out how to stop it at the end.

Any ideias?


The big picture, im creating a led tree, show it should fade all the time, very smoothly and in a long period of time, and stay switching colors.

If only i knew how to stop the fade at the end of it.
10  Using Arduino / LEDs and Multiplexing / TLC5940, cant fade more than 12 pins at the same time? on: August 06, 2013, 10:19:08 am
Guys... im a bit lost here...

Im building a small led tree, using TLC5940 and RGB leds

im trying to fade 16 rgb leds at the same time, at the beginning only the blue pins...

when i ran the fade example. it all works ok. But then i try to fade all the blue pins (or, red, green, dosent matter wich), i just only fade the first 12 ones...

here is my code:

Code:
#include "Tlc5940.h"
#include "tlc_fades.h"

int pinR[16] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int pinG[16] = {1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46};
int pinB[16] = {2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47};

int i = 0;

void setup()
{
  Tlc.init();
}

void loop(){


    if (!tlc_isFading(pinB[0])) {
        uint16_t duration = 3000;
        int maxValue = 4095;
        uint32_t startMillis = millis() + 50;
        uint32_t endMillis = startMillis + duration;
       
        for(int a =0; a < 16; a++){
          tlc_addFade(pinB[a], 0, maxValue, startMillis, endMillis);
          tlc_addFade(pinB[a], maxValue, 0, endMillis, endMillis + duration);
        }
    }
       
  tlc_updateFades();

}

im using the library Tlc5940_r014.zip    Latest Stable Build as of May 7th, 2009

thanks for the help!
11  International / Portugues / Re: sensor LM35 retornando valor negativo on: October 03, 2012, 08:46:07 am
o fonte é simples...
http://pastebin.com/AR8ieXMb

to suspeitando que seja algum mal funcionamento no sensor... pois é bem esporadico esse problema, tem hora que do nada comeca a soltar valor negativo.. tipo de 30 para -30
12  International / Portugues / sensor LM35 retornando valor negativo on: October 02, 2012, 11:30:41 am
Pessoal,

Estou aprendendo sobre o arduino... cheguei naquele ponto de aprender a usar o sensor de temperatura LM35

Beleza, funciona tudo bem.. ele le os valores... so que do nada, derrepende de 30, ele comeca a retornar pela serial -30

e fica nessa de mandar valor negativo....

nao... nao esta tao frio assim...

é normal ele fazer isso? devo converter tudo p/ positivo? tem alguma funcaozinha que ja faz isso?

Grato,
Tesso M .Costa
Pages: [1]