Hi all,
I'll post my code then explain:
// RADIO - HABE 1 - The Explorer
// Code to output "Hello World!" to NTX2
// 50 Baud, RTTY
int Power_out = 2; //Pin for 5V DC Out is pin 2
int running_time = millis(); // Timer counting how long program has been running
#define RADIO_SPACE 5
#define RADIO_MARK 4
#define ASCII_BIT 8
void rtty_txstring (char * string) {
char c;
c = *string++;
while ( c != '\0') {
rtty_txbyte (c);
c = *string++;
}
}
void rtty_txbyte (char c) {
int i;
rtty_txbit (0); // Start bit
// Send bits for for char LSB first
for (i=0; i<ASCII_BIT; i++) {
if (c & 1)
rtty_txbit(1);
else
rtty_txbit(0);
c = c >> 1;
}
rtty_txbit (1); // Stop bit
rtty_txbit (1); // Stop bit 2
}
void rtty_txbit (int bit) {
if (bit) {
digitalWrite(RADIO_SPACE, LOW);
digitalWrite(RADIO_MARK, HIGH);
} else {
digitalWrite(RADIO_SPACE, HIGH);
digitalWrite(RADIO_MARK, LOW);
}
// This works out to a baud rate of 50 bps. Somehow.
delay(19);
delayMicroseconds(250);
}
void setup() {
pinMode(Power_out, OUTPUT);
pinMode(RADIO_SPACE, OUTPUT);
pinMode(RADIO_MARK, OUTPUT);
}
void loop() {
digitalWrite (Power_out, HIGH); // Set power output pin to supply power (5V)
rtty_txstring("Hello World!"); // Broadcast "Hello World!"
delay(1000);
rtty_txstring(running_time);
delay(1000);
}
What I want to do is output the time that the arduino has been running the program for (running_time) however when I put it into rtty_txstring(running_time) it gives me the following error:
In function 'void loop()':
error: invalid conversion from 'int' to 'char*
:S The code i'm using is from someone elses project who has let me use it, so i'm not exactly sure what everything does as i'm only a newbie! It's probably a really simple solution, but I'm not sure!?!
Any ideas?
Thanks!