hi guy I have this code that had try several times to compile but unsucceful any help?
this is the code and the error message.
#include "Arduino.h"
//#include<SoftwareSerial.h>
// constants won't change. Used here to set a pin number:
const int TotransPin = 6; // the number of the transistor base pin
#define droneSig 4 //..input signal from drone FC
//SoftwareSerial BTSerial(0, 1); // RX TX
// Variables will change:
int TransistorState = LOW; // TransistorState used to set the Transistor
unsigned long previousMillis = 0; // will store last time Transistor was updated
// varible to store time interval:
long interval = 0;
// interval at which to blink (milliseconds)
void setTrans(String message);
String bluetoothData = "";
String getNextNumb(String text, int cursor);
void setup(){
Serial.begin(9600);
//set the digital pin as input:
pinMode(droneSig, INPUT);
// set the digital pin as output:
pinMode(TotransPin, OUTPUT);
}
// message tokens
const char START_TOKEN = '?';
const char END_TOKEN = ';';
const char DELIMIT_TOKEN = '&';
const int CHAR_TIMEOUT = 20;
bool waitingForStartToken = true;
String messageBuffer = "";
//BTSerial.begin(9600);
void loop() {
char inchar ;
if (Serial.available ()){
if (waitingForStartToken){
do {
inchar = Serial.read();
}
while ((inchar != START_TOKEN) && Serial.available());
if(inchar == START_TOKEN) {
Serial.println("message start");
waitingForStartToken = false;
}
}
// read command
if (!waitingForStartToken && Serial.available()){
do{
inchar = Serial.read();
Serial.println(inchar);
messageBuffer += inchar;
} while ((inchar != END_TOKEN) && Serial.available());
if (inchar == END_TOKEN){
messageBuffer = messageBuffer.substring(0, messageBuffer.length() - 1);
Serial.println("massage complete - " + messageBuffer);
*setTrans(messageBuffer);*
messageBuffer = "";
waitingForStartToken = true;
}
if (messageBuffer.length() > CHAR_TIMEOUT){
Serial.println("message data timeout - " + messageBuffer);
messageBuffer = "";
waitingForStartToken = true;
}
}
}
if (isDigit(inchar)) {
bluetoothData += (char)inchar;
if (inchar == '\n') {
interval = bluetoothData.toInt();
}
}
/* while(bluetoothData = Serial.available());
do {
interval = bluetoothData.toInt();
}
*/
// while(interval)
// here is where you'd put code that needs to be running all the time.
// check to see if it's time to turn the motor; that is, if the difference
// between the current time and last time you turn the motor is bigger than
// the interval at which you want to turn the motor.
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you turn the motor
previousMillis = currentMillis;
// if the motor is off turn it on and vice-versa:
if (digitalRead(droneSig == HIGH) && (TransistorState == LOW))
{
(TransistorState = HIGH);
}
else {
TransistorState = LOW;
}
// set the LED with the ledState of the variable:
digitalWrite(TotransPin, TransistorState);
Serial.println("motor is turning.");
}
}
Arduino: 1.8.15 (Windows 8.1), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"
In function loop': ino:68: undefined reference to setTrans(String)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Pro or Pro Mini.