Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Installation & Troubleshooting / Re: COMPILE AND DOWNLOAD LINE COMMAND on: February 08, 2014, 03:51:37 am
File:preferences, turn on verbose outputs, you can see what the iDE is doing and do the same.

I tried, but isn't easy.. have so much commands, copy, compile, copy...
2  Using Arduino / Installation & Troubleshooting / COMPILE AND DOWNLOAD LINE COMMAND on: February 07, 2014, 02:24:21 pm
Hi friends.. I tried to use ArduinoBuilder to compile my strechs but dont work fully... So, I'm trying to use arduino to do that using command line, but I can't do... I tried using abuild.bat from arduino.cc but dont work also. If I use Arduino GUI, code is compiled and uploaded.
    Have a way to use command lines to do this tasks?
    Note: I search in google.com but I don't found nothing working..
   Win7 64Bits, arduino1.0.5
3  Using Arduino / LEDs and Multiplexing / Re: PWM Controling Various LED's on: January 31, 2014, 07:20:38 pm
Hi wizarcl,

Those 10K base resistors seem high to me. How did you work them out?
Sorry, I'm using 1K resistor and not 10K..
Quote
Why do you want to turn the pwm timers off, what is wrong with using analogWrite (x, 0)?

Paul
No problem with analogWrite(x,0), but, I would like to know why does not work. Theoretically it should.
I replace BC459 by TIP120 (more current limit, because, limit of BC is 200mA) and the problem with turnOffPWM isn't solved... I will try to measure Arduino PWM Outputs...
4  Using Arduino / LEDs and Multiplexing / PWM Controling Various LED's on: January 30, 2014, 07:51:44 pm
This is my ciruit of my project:
                                                                                                      LED3_RED              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                                           |             LED2_RED              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------     +5V
                                                                                           |             LED1_RED              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                      10kOhms  |
Pin 9 (PWM) _|¯|_|¯|_|¯|_|¯|_   ----/\/\/\-----/             transistor BC549
                                                                                          \>   Emiter
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           GND

                                                                                                        LED3_GREEN              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                                           |             LED2_GREEN              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                                           |             LED1_GREEN              56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                      10kOhms  |
Pin 10 (PWM) _|¯|_|¯|_|¯|_|¯|_   ----/\/\/\-----/             transistor BC549
                                                                                          \>   Emiter
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           GND

                                                                                                        LED3_BLUE         56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                                           |            LED2_BLUE         56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                                           |             LED1_BLUE         56 Ohms
                                                                                           |-------(<)------------/\/\/\/\------------      +5V
                                                                      10kOhms  |
Pin 11 (PWM) _|¯|_|¯|_|¯|_|¯|_   ----/\/\/\-----/             transistor BC549
                                                                                          \>   Emiter
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           |
                                                                                           GND

BC549 datasheet says... VCEsat (Coletor-Emiter Voltage in Saturation) is 0.2V with IC=100mA...
(5V - 0,2(VCEsat) - 3,3 (LED)) / 56Ohms =~ 27mA  per LED

It's working, but i wanna a second opnion about this circuit.

I have only one problem... When I write
Code:
turnOffPWM(TIMER1A)  //Pin9
turnOffPWM(TIMER1B) //Pin10
turnOffPWM(TIMER2A) //Pin11

to turn off Timers, but only working to TIMER2A (pin11). If I disconect transistor for RED, GREEN and BLUE turn off... Maybe same problem with polarization of transistors?
If I write:
Code:
analogWrite(9,0);
analogWrite(10,0);
analogWrite(11,0);
All colors is switched off...
5  Using Arduino / Programming Questions / Re: PROGMEM Array with Hex codes on: December 26, 2013, 07:29:34 pm
Are all those items actually pointer values ?

If they are,   then  long* []  is OK.   Otherwise not.

Yes... all are pointers... so much. Because this I'm using PROGMEM...
I have these codes for my HT (53 commands with 4bytes each) and more 2 devices with 50 commands each... 150 x 4 bytes = 600 bytes.
6  Using Arduino / Programming Questions / Re: PROGMEM Array with Hex codes on: December 25, 2013, 05:45:10 pm
Happens to the best of us sometimes, that's why a second set of eyes is good.
Right. Agree!
7  Using Arduino / Programming Questions / Re: PROGMEM Array with Hex codes on: December 23, 2013, 09:05:41 am
Sorry for this big mistake...
8  Using Arduino / Programming Questions / PROGMEM Array with Hex codes on: December 23, 2013, 08:07:19 am
Hi friends, i trie'd do this but don't work. How can I do?

Code:
#define SHT_POWER 0xC2CA807F //Turn on-off
#define SHT_EJECT 0xC2CA0CF3 //Eject
#define SHT_SLEEP 0xC2CA847B //Sleep
#define SHT_FUNCTION 0xC2CA8877 //HT Function
#define SHT_DISC_MENU 0xC2CA5AA5 //Disc menu
#define SHT_TITLE_MENU 0xC2CACA35 //Title menu

#define SHT_0 0xC2CAF40B //Number 0
#define SHT_1 0xC2CA827D //Number 1
#define SHT_2 0xC2CA42BD //Number 2
#define SHT_3 0xC2CAC23D //Number 3
#define SHT_4 0xC2CA22DD //Number 4
#define SHT_5 0xC2CAA25D //Number 5
#define SHT_6 0xC2CA629D //Number 6
#define SHT_7 0xC2CAE21D //Number 7
#define SHT_8 0xC2CAFC03 //Number 8
#define SHT_9 0xC2CAEC13 //Number 9

#define SHT_PREVIOUS 0xC2CAD827 //Previous
#define SHT_NEXT 0xC2CAC837 //Next
#define SHT_BACKWARD 0xC2CA2ED1 //Backward
#define SHT_FORWARD 0xC2CAAE51 //Forward
#define SHT_PLAY 0xC2CAC03F //Play
#define SHT_STOP 0xC2CAD02F //Stop
#define SHT_PAUSE 0xC2CABE41 //Pause
#define SHT_REPEAT 0xC2CA6699 //Repeat

#define SHT_VOL_UP 0xC2CACC33 //Volume up
#define SHT_VOL_DOWN 0xC2CADC23 //Volume down
#define SHT_MUTE 0xC2CA9C63 //Mute
#define SHT_TV_SOUND 0xC2CA51AE //Sound only in tv
#define SHT_TUNNING_UP 0xC2CAC43B //Radio tunning up
#define SHT_TUNNING_DOWN 0xC2CAD42B //Radio tunning down

#define SHT_HOME 0xC2CA6C93 //Home
#define SHT_SCREEN 0xC2CA0EF1 //Full screen mode
#define SHT_TOOLS 0xC2CA28D7 //Tools
#define SHT_INFO 0xC2CA649B //Info

#define SHT_UP 0xC2CAB04F //Up
#define SHT_DOWN 0xC2CAA857 //Down
#define SHT_LEFT 0xC2CAA45B //Left
#define SHT_RIGHT 0xC2CAB847 //Right
#define SHT_ENTER 0xC2CAA05F //Enter
#define SHT_RETURN 0xC2CA38C7 //Return
#define SHT_EXIT 0xC2CA7E81 //Exit

#define SHT_SMART 0xC2CADE21 //View
#define SHT_AUDIO 0xC2CA609F //Audio
#define SHT_SUBTITLE 0xC2CA708F //Subtitle
#define SHT_3D_SOUND 0xC2CAC13E //3D sound
#define SHT_SOUND 0xC2CA5EA1 //Sound effect
#define SHT_SUB_LEVEL 0xC2CAF00F //Subwoofer level
#define SHT_SERACH 0xC2CA817E //Search
#define SHT_MANUAL 0xC2CAB14E //Off-line manual

#define SHT_A 0xC2CADA25 //A
#define SHT_B 0xC2CA2AD5 //B
#define SHT_C 0xC2CAAA55 //C
#define SHT_D 0xC2CAEE11 //D

PROGMEM unsigned long *sht_codes[] = {
SHT_POWER, SHT_FUNCTION, SHT_EJECT, SHT_SLEEP, SHT_DISC_MENU, SHT_TITLE_MENU,
SHT_0, SHT_1, SHT_2, SHT_3, SHT_4, SHT_5, SHT_6, SHT_7, SHT_8, SHT_9,
SHT_PREVIOUS, SHT_NEXT, SHT_BACKWARD, SHT_FORWARD, SHT_PLAY, SHT_STOP, SHT_PAUSE,
SHT_VOL_UP, SHT_VOL_DOWN, SHT_MUTE, SHT_TV_SOUND, SHT_TUNNING_UP, SHT_TUNNING_DOWN,
SHT_HOME, SHT_SCREEN, SHT_REPEAT, SHT_TOOLS, SHT_INFO,
SHT_UP, SHT_DOWN, SHT_LEFT, SHT_RIGHT, SHT_ENTER, SHT_RETURN, SHT_EXIT,
SHT_SMART, SHT_AUDIO, SHT_SUBTITLE, SHT_3D_SOUND, SHT_SOUND, SHT_SUB_LEVEL, SHT_SERACH, SHT_MANUAL,
SHT_A, SHT_B, SHT_C, SHT_D};

Message:
Quote
F:\arduino-1.0.5\libraries\IRCodes/IRCodes.h:204: error: invalid conversion from 'long unsigned int' to 'long unsigned int*'

Hex codes have 4bytes and unsigned long also. So, why it don't work?
Sorry for my english...
9  Using Arduino / Programming Questions / Re: [QUESTION]FATAL ERROR IN ARDUINO on: November 14, 2013, 05:17:26 pm
That's why Atmel invented strcmp_P

(BTW we can't see "findCommand")

Excuse my ignorance.

Code:
#include <SerialCommand.h>
#include <pgmspace.h>
#define SIZE_SERIAL_COMMAND 16   //Define max size of message from serial communication
char serialCommand[SIZE_SERIAL_COMMAND+1];  //String received, zero indexed

PROGMEM const char *commands[] = {"TEST","TEST2","TEST3"};
uint8_t command;


void setup()
{
  Serial.begin(9600);
}

void loop(){
  if(serialNewCommand()){
   command = findCommand(commands,3);
   Serial.println("Commando encontrado: ");
   Serial.println(command);
  }
}

byte findCommand(const char **cmd, uint8_t storedCommands){
uint8_t taskIndex = storedCommands; //What task is matched from the serial, put out range to do switch case....
storedCommands -= 1; //Zero indexed
for(int i=0; i<=storedCommands; i++){
Serial.println(cmd[i]);
if(strcmp_P(serialCommand,cmd[i]) == 0){ //Find command in cmd[]
taskIndex = i;
}
}
serialCommand[0] = '\0'; //Comparison done, so flush array in start position. newSerialCommand returns false now.
return taskIndex;
}

void serialGetCommand(){
    if(Serial.available()) {   //If data available in serial buffer
Serial.println("New data, receiving: ");
uint8_t i = 0; //Pointer in start position
delay(50);
while(Serial.available()){   //Read message, mount array
cli(); //Stop interruptions
serialCommand[i] = Serial.read(); //Read byte
if(serialCommand[i] == '.'){ //Next message
serialCommand[i] = '\0';   //Flush array
break;
}
i++; //Increase array
serialCommand[i] = '\0';   //Flush array
if(i == SIZE_SERIAL_COMMAND){
break;
}
}
sei(); //Return interruptions
}
else{
serialCommand[0] = '\0'; //No data avalibe
}
}

bool serialNewCommand(){
serialGetCommand();
if (strlen(serialCommand) > 0){ //If your command was received
return true;
}
else{
return false; //Nothing received
}
}
10  Using Arduino / Programming Questions / Re: [QUESTION]FATAL ERROR IN ARDUINO on: November 14, 2013, 05:01:12 pm
Use PROGMEM
I tried, but whit PROGMEM strcmp inside findCommand() function dont work.
Dont generate error in compiler.
11  Using Arduino / Programming Questions / [QUESTION]FATAL ERROR IN ARDUINO on: November 14, 2013, 03:27:38 pm
What happens if I fill the RAM of the Arduino? And I have this code below, how do I not load all commands in RAM?

Code:
#include <BitVoicer11.h>
#include <IRCodes.h>
#define QTD 100
const char commands[][16] = {
//HOME THEATER GOLDSHIP
"HRC_POWER","HRC_MUTE","HRC_MATER_UP","HRC_MASTER_DOWN","HRC_SUB_UP","HRC_SUB_DOWN",
"HRC_FRONT_UP","HRC_FRONT_DOWN","HRC_CENTER_UP","HRC_CENTER_DOWN","HRC_REAR_UP","HRC_REAR_DOWN",
"HRC_TREBLE_UP","HRC_TREBLE_DOWN","HRC_MID_UP","HRC_MID_DOWN","HRC_BASS_UP","HRC_BASS_DOWN",
//SMART TV SANSUMG
"STS_POWER","STS_HDMI","STS_SOURCE",
"STS_0","STS_1","STS_2","STS_3","STS_4","STS_5","STS_6","STS_7","STS_8","STS_9",
"STS_VOL_UP","STS_VOL_DOWN","STS_CH_UP","STS_CH_DOWN","STS_PRE_CH","STS_MUTE","STS_CHLIST","STS_HYPHEN",
"STS_MENU","STS_TOOLS","STS_SMART","STS_GUIDE","STS_INFO",
"STS_UP","STS_DOWN","STS_LEFT","STS_RIGHT","STS_ENTER","STS_RETURN","STS_EXIT",
"STS_A","STS_B","STS_C","STS_D",
"STS_FAMILY","STS_SEARCH","STS_3D","STS_SUPPORT","STS_PSIZE","STS_CC",
"STS_BACKWARD","STS_FORWARD","STS_PLAY","STS_PAUSE","STS_STOP","STS_REC",
//SMART BLUE RAY PLAYER SANSUMG
"BDS_POWER","BDS_EJECT","BDS_DISC_MENU","BDS_TITLE_MENU",
"BDS_0","BDS_1","BDS_2","BDS_3","BDS_4","BDS_5","BDS_6","BDS_7","BDS_8","BDS_9",
"BDS_PREVIOUS","BDS_NEXT","BDS_BACKWARD","BDS_FORWARD","BDS_PLAY","BDS_STOP","BDS_PAUSE",
"BDS_HOME","BDS_NETFLIX","BDS_SMART","BDS_TOOLS","BDS_INFO",
"BDS_UP","BDS_DOWN","BDS_LEFT","BDS_RIGHT","BDS_ENTER","BDS_RETURN","BDS_EXIT",
"BDS_VIEW","BDS_AUDIO","BDS_SUBTITLE","BDS_SCREEN",
"BDS_A","BDS_B","BDS_C","BDS_D"
};
byte command = QTD;
BitVoicerSerial bitVoicer = BitVoicerSerial();

void setup(){
  Serial.begin(9600);
  Serial.println(sizeof(commands));
  Serial.println(strlen(commands[0]));
}

void loop(){
}

void serialEvent(){
  bitVoicer.getData();
  for(byte i=0; i<=QTD-1; i++){
    if(bitVoicer.strData.equals(commands[i])){
      command = i;
    }
    switch(command){
..   
    }
  }
}
12  Using Arduino / Programming Questions / Re: Receiving multidimensional array in a function on: November 10, 2013, 08:00:09 pm
I tried but dont work...

Code:
void findCommand(char **cmd){
...
}

void loop(){
  if(serialNewCommand()){
    findCommand(commands);
  }
}

Quote
SerialCommand.ino: In function 'void loop()':
SerialCommand:14: error: cannot convert 'char (*)[9]' to 'char**' for argument '1' to 'void findCommand(char**)'

 I got it another way, comparing each command, but would like to learn how to point to the array of array ...

Workking with this:
Code:
void loop(){
getSerial();
}

void getSerial(){
    if (serialNewCommand()){
         if(matchCommand(commands[0])){
         //
    }
    if(matchCommand(commands[1])){
         //
     }
    }
  }
}

bool matchCommand(char *cmd){
if(strcmp(serialCommand,cmd) == 0){ //Compare command whit message received from serial
return true;
}
else{
return false;
}
}
13  Using Arduino / Programming Questions / Re: Receiving multidimensional array in a function on: November 10, 2013, 09:52:52 am
Ok... I understand and this way work's....
But if I want to point to the array [] [] can I do this? Have a way to send all data to function?
14  Using Arduino / Programming Questions / Re: Receiving multidimensional array in a function on: November 09, 2013, 03:25:34 pm
Ok...

SerialCommand.h
Code:
#include "Arduino.h"
//--------------------------------DECLARATIONS-------------------------------------
char serialCommand[8];  //String received
byte serialIndex = 0;                          //Index to write char in string

//----------------------------READ COMMAND FROM SERIAL-----------------------------
void readSerialCommand(){
    if(Serial.available()) {   //If data available in serial buffer
serialIndex = 0; //Move to start array position
delay(50); //Wait to receive complete message
while(Serial.available()){   //Read message, mount array
  cli(); //Stop interruptions
          serialCommand[serialIndex] = Serial.read(); //Read byte
          serialIndex++; //Increase array
          serialCommand[serialIndex] = '\0';   //Flush array
       }
   sei(); //Return interruptions
    }
}

//--------------------------------HAVE NEW COMMAND?---------------------------------
bool newSerialCommand(){
readSerialCommand();
if (strlen(serialCommand) > 0){ //If your command was received
if (debugCommand){ //If debug is active
printSerialCommand(); //Print command
}
return true; //Device received a new message
}
else{
return false; //Nothing received
}
}

//-----------------------COMPARE COMMAND RECEIVED FROM SERIAL-----------------------
int findCommand(char cmd[]){
uint8_t storedCommands = sizeof(cmd[])/(MAX_SIZE_SERIAL_COMMAND+1); //How many commands are configured
uint8_t taskIndex = storedCommands+1; //What task is matched from the serial, put out range to do switch case....

for(int i=0; i<=storedCommands; i++){
if(strcmp(serialCommand,cmd[i]) == 0){ //Find command in commands[]
taskIndex = i;
}
}
serialCommand[0] = '\0'; //Command received, so flush array in start position. newSerialCommand returns
false now.
    return taskIndex
}

Comunication.ino
Code:
#include <SerialCommand.h>
char commands[][9] = {"TESTE1","TESTE2","TESTE3"}; //Array of commands from serial
int task;
void setup() {
  Serial.begin(115200);
}
 
void loop(){
  if (newSerialCommand()){
    task = findCommand(commands[]);
   switch (task)... //missing programming
  } 
}

Thanks in advance!
15  Using Arduino / Programming Questions / Receiving multidimensional array in a function on: November 09, 2013, 02:56:01 pm
Hi friends.. I need your help with this...
I wanna send this array to this function:

piece of code...

Code:
char commands[][9] = {"TEST1","TEST2","TEST3"};

void findCommand(char cmd[]){
for(int i=0; i<=storedCommands; i++){
if(strcmp(receivedCommand,cmd[i]) == 0){
taskIndex = i;
}
}
void loop(){
  if (newCommandReceived()){
    findCommand(commands[]);
  } 
}
Pages: [1] 2 3 ... 5