OldSteve:
Don't ask for me specifically. Just describe the problem, post your code and ask for help. Someone will hopefully try to help, but not necessarily me.
(And no more private messages please. See my signature below.)
Thank you so much for helping me with that...i was able to read about concatenation and use compare together to complete and verify the received morse..
Thanks to everyone for help.
I have a small problem i need help with..
i have programmed 4 pro micro boards with this code
#define THRESHOLD (600)
#define MAX_SAMPLES (5)
#define BAUD (100.0)
#define WAIT (5.0)
#define AVG_LONG (BAUD*3.0/WAIT)
#define AVG_SHORT (BAUD*1.0/WAIT)
#define AVG_NEWWORD (BAUD*7.0/WAIT)
#define MINIMUM (AVG_SHORT/4.0)
#define MAX_PATTERN (64)
#define NUM_CODES (54)
char key[100] = "XARDUINOTRANSMITANDRECEIVE";
char Catination[100] ;
int count = 26;
int k=0;
int dummy;
// 0 10 20 30 40 50
// 0123456789012345678901234567890123456789012345678901234
static const char *letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?'!/()&:;=+-_\"$@";
// 1 represents a dot and 0 represents a dash.
static const char *codes[NUM_CODES] = {
"10", // A, codes[0]
"0111", // B, codes[1]
"0101", // C
"011", // D
"1", // E
"1101", // F
"001", // G
"1111", // H
"11", // I
"1000", // J
"010", // K
"1011", // L
"00", // M
"01", // N
"000", // O
"1001", // P
"0010", // Q
"101", // R
"111", // S
"0", // T
"110", // U
"1110", // V
"100", // w
"0110", // x
"0100", // y
"0011", // z
"00000", // 0
"10000", // 1
"11000", // 2
"11100", // 3
"11110", // 4
"11111", // 5
"01111", // 6
"00111", // 7
"00011", // 8
"00001", // 9
"101010", // .
"001100", // ,
"110011", // ?
"100001", // '
"010100", // !
"01101", // /
"01001", // (
"010010", // )
"10111", // &
"000111", // :
"010101", // ;
"01110", // =
"10101", // +
"01110", // -
"110010", // _
"101101", // "
"1110110", // $
"100101", // @, codes[54]
};
int top=0;
int samples[MAX_SAMPLES];
int si=0;
int mi=0;
int total=0;
int c=0;
int is_on=0;
char pattern[MAX_PATTERN];
int pi=0;
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
for(int i=0;i<MAX_SAMPLES;++i) {
samples[i]=0;
}
for(int i=0;i<MAX_PATTERN;++i) {
pattern[i]=0;
}
}
void loop() {
int volume=analogRead(0);
total -= samples[si];
samples[si] = volume;
total += samples[si];
if( mi < MAX_SAMPLES ) mi++;
si = (si+1) % MAX_SAMPLES;
int average = total / mi;
if( top < average ) top = average;
int x = 10.0 * (float)(average-THRESHOLD)/(float)(top-THRESHOLD);
if(x<0) x=0;
if(x>10) x=10;
if(x>1) {
// noise!
if(is_on==0) {
// noise has just started.
if( c > MINIMUM ) {
// Was the silence a new word or a new letter?
if( c > (AVG_NEWWORD+AVG_SHORT)/2.0 ) {
pattern[pi]=0;
findLetter();
// new word, extra \n
Serial.println();
// start counting - and . all over again.
pi=0;
} else if( c > (AVG_LONG+AVG_SHORT)/2.0 ) {
pattern[pi]=0;
findLetter();
// start counting - and . all over again.
pi=0;
}
}
// remember noise started
is_on=1;
c=0;
}
} else {
// silence!
if(is_on==1) {
// silence is new
if( c > MINIMUM ) {
if( c > (AVG_LONG + AVG_SHORT)/2.0 ) {
Serial.print('-');
pattern[pi++]='0';
} else {
Serial.print('.');
pattern[pi++]='1';
}
}
// remember silence started
is_on=0;
c=0;
}
}
c++;
delay(WAIT);
}
// saved as 1s and 0s. Find the matching code in the list
// then find the matching printable character.
// print '?' if nothing is found
void findLetter()
{
int i,j;
// go through all the codes
for(i=0;i<NUM_CODES;i++)
{
if(strlen(pattern) == strlen(codes[i]) && strcmp(pattern,codes[i])==0)
{
// match!
Serial.print(' ');
Serial.println(letters[i]);
if(strcmp(pattern,codes[23])==0)
{
dummy = 1;
}
if(dummy==1)
{
Catination[k] = letters[i];
k++ ;
if (k==count)
{
k = 0;
dummy = 0;
Serial.print("strings are equal");
Serial.print(Catination);
if (strcmp(Catination,key )== 0 )
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
}
}
}
return;
}
}
Serial.print('?');
}
and i will be connecting these 4 boards to an arduino uno board at different digital pins(as digital input pins)...
so to power all the boards together i have a 5V 8Amp power supply...
i think that 8Amp is too much for the boards to handle...
can i get help with understanding the amount of current i can supply the boards..?
and what is the internal resistance of one board...using that information i can calculate the resistance i need to connect to reduce the amp supplied..
i know the internal resistance for the uno board...but i cant find any information on the pro micro boards..
i have planned to connect all boards in parallel to keep the voltage constant, but the current is what worries me...
please help