hello, i am very new to arduino as this is my first project and havent done any coding at all in about 10 years
i may have picked a big project to start with but here goes,
i think im getting formatting issues? not totally sure if ive done everything right, basically reads the input on 3 wires to determine where the selector is and then will control solenoids( i havent coded for the motor controller just the rough logic) but im getting 240 and 302 errors, any advice would be greatly appreciated
_4l60e_pcm_v0_04:75:4: error: stray '\302' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:5: error: stray '\240' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:27: error: stray '\302' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:28: error: stray '\240' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:32: error: stray '\302' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:33: error: stray '\240' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:41: error: stray '\302' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:75:42: error: stray '\240' in program
int rangeselector(boolean a, boolean b, boolean c) {
^
_4l60e_pcm_v0_04:76:3: error: stray '\302' in program
int selectorposition;
^
_4l60e_pcm_v0_04:76:4: error: stray '\240' in program
int selectorposition;
^
_4l60e_pcm_v0_04:76:5: error: stray '\302' in program
int selectorposition;
^
_4l60e_pcm_v0_04:76:6: error: stray '\240' in program
int selectorposition;
^
_4l60e_pcm_v0_04:76:10: error: stray '\302' in program
int selectorposition;
^
_4l60e_pcm_v0_04:76:11: error: stray '\240' in program
int selectorposition;
^
_4l60e_pcm_v0_04:96:3: error: stray '\302' in program
return selectorposition;
^
_4l60e_pcm_v0_04:96:4: error: stray '\240' in program
return selectorposition;
^
_4l60e_pcm_v0_04:96:5: error: stray '\302' in program
return selectorposition;
^
_4l60e_pcm_v0_04:96:6: error: stray '\240' in program
return selectorposition;
^
_4l60e_pcm_v0_04:96:13: error: stray '\302' in program
return selectorposition;
^
_4l60e_pcm_v0_04:96:14: error: stray '\240' in program
return selectorposition;
^
/home/n1t3/Documents/Arduino/_4l60e_pcm_v0_04/_4l60e_pcm_v0_04.ino: In function 'void loop()':
_4l60e_pcm_v0_04:48:25: error: 'rangeselector' was not declared in this scope
rangeswitchposition = rangeselector(rpnswitch[0], rpnswitch[1], rpnswitch[2]);
^~~~~~~~~~~~~
exit status 1
stray '\302' in program
sorry it took me a bit to figure out how to copy it all lol
copied the code? i wrote all this on my phone using one of the examples for the leds to start, i just got my computer fixed loaded it all up and i get these errors at my rangeselector function....i dont have any other links for it besides the file i uploaded to my drive account....also im very sorry but im not really sure what you mean by code tags
//4l60 pcm program v0.04
//by Jesse Lemay
// has tps, range selector and paddle shifter input and logic roughly coded, shift solenoid logic coded
// set input pin numbers:
const int leftpaddleopen = 2;
const int rightpaddleopen = 3;
const int leftpaddlepressed = 7;
const int rightpaddlepressed = 8;
const int n = 9;
const int r = 10;
const int p = 11;
//output pin numbers:
// variables can/will change:
boolean downshift = 0;
boolean upshift = 0;
int preshiftdelay = 200;
int postshiftdelay = 200; //shift delays before and after for safety, allows solenoids to actuate properly before next shift 1000=1s
int rangeswitchposition; //rangeselector integer value SEE FUNCTION
boolean paddlestateleft = 0;
boolean paddlestateright = 0; // variable for reading the paddle status
//arrays
boolean shiftsolenoids[4];//solenoids applied (includes tcc and 3-2) 0 is A, 1 is B, 2 is tcc, 3 is 3-2
boolean rpnswitch[3];//park reverse neutral range selector switch input value array
int solenoidpwm[3];//pwm array
void setup() {
Serial.begin(9600);//debug output init
// initialize the paddle pins as an input:
pinMode(leftpaddleopen, INPUT);
pinMode(rightpaddleopen, INPUT);
pinMode(leftpaddlepressed, INPUT);
pinMode(rightpaddlepressed, INPUT);
//park/reverse/neutral range selector switch input from trans connector pins n,r,p
pinMode(n, INPUT);
pinMode(r, INPUT);
pinMode(p, INPUT);
}
void loop() {
//prn range selector switch values read/write and logic check
rpnswitch[0] = digitalRead(n);
rpnswitch[1] = digitalRead(r);
rpnswitch[2] = digitalRead(p);
rangeswitchposition = rangeselector(rpnswitch[0], rpnswitch[1], rpnswitch[2]);
//if range selector reads drive read the state of the paddle value:
if (rangeswitchposition == 2) {
if (digitalRead(leftpaddlepressed == HIGH) && digitalRead(leftpaddleopen == LOW)) {
paddlestateleft = 1;
} else {
paddlestateleft = 0;
}
if (digitalRead(rightpaddlepressed == HIGH) && digitalRead(rightpaddleopen == LOW)) {
paddlestateright = 1;
} else {
paddlestateright = 0;
}
// check if the paddle is pressed.
paddlestates (paddlestateleft, paddlestateright);
}
}
// Functions
//tps input
int tpsvalue(int pin) {
int value;
value = analogRead(pin);
return value;//from 0-1023
}
//range selector array logic function
int rangeselector(boolean a, boolean b, boolean c) {
int selectorposition;
if (a == HIGH and (b == LOW and (c == HIGH))) {
selectorposition = 0;//P/N
}
if (a == LOW and (b == LOW and (c == HIGH))) {
selectorposition = 1;//R
}
if (a == LOW and (b == HIGH and (c == HIGH))) {
selectorposition = 5;//D1
}
if (a == HIGH and (b == HIGH and (c == HIGH))) {
selectorposition = 4;//D2
}
if (a == HIGH and (b == HIGH and (c == LOW))) {
selectorposition = 3;//D3
}
if (a == HIGH and (b == LOW and (c == LOW))) {
selectorposition = 2;//D
}
return selectorposition;
//0=P/N, 1=R, 2=D, 3=D3, 4=D2, 5=D1
}
//basic function for solenoid control table
int solenoidcontrol(int gear, int tps, boolean up, boolean down) {
boolean solA, solB, solC, tcc;
if (gear == 1) {
solA = 1;
solB = 1;
} if (gear == 2) {
solA = 0;
solB = 1;
} if (gear == 3) {
solA = 0;
solB = 0;
} if (gear == 4) {
solA = 1;
solB = 0;
}
return (solA, solB, solC, tcc);
}
boolean paddlestates (boolean paddlestateleftf, boolean paddlestaterightf) {
// check if the paddle is pressed.
// if it is, the paddleState is HIGH:
if (paddlestateleftf == HIGH && paddlestaterightf == LOW) {
// turn LED on:
downshift = HIGH;
delay(preshiftdelay);
} else {
// turn LED off:
downshift = LOW;
delay(postshiftdelay);
}
if (paddlestaterightf == HIGH && paddlestateleftf == LOW) {
// turn LED on:
upshift = HIGH;
delay(preshiftdelay);
} else {
// turn LED off:
upshift = LOW;
delay(postshiftdelay);
}
}
//functions end
//4l60 pcm program v0.04
//by Jesse Lemay
// has tps, range selector and paddle shifter input and logic roughly coded, shift solenoid logic coded
// set input pin numbers:
const int leftpaddleopen = 2;
const int rightpaddleopen = 3;
const int leftpaddlepressed = 7;
const int rightpaddlepressed = 8;
const int n = 9;
const int r = 10;
const int p = 11;
//output pin numbers:
// variables can/will change:
boolean downshift = 0;
boolean upshift = 0;
int preshiftdelay = 200;
int postshiftdelay = 200; //shift delays before and after for safety, allows solenoids to actuate properly before next shift 1000=1s
int rangeswitchposition; //rangeselector integer value SEE FUNCTION
boolean paddlestateleft = 0;
boolean paddlestateright = 0; // variable for reading the paddle status
//arrays
boolean shiftsolenoids[4];//solenoids applied (includes tcc and 3-2) 0 is A, 1 is B, 2 is tcc, 3 is 3-2
boolean rpnswitch[3];//park reverse neutral range selector switch input value array
int solenoidpwm[3];//pwm array
void setup() {
Serial.begin(9600);//debug output init
// initialize the paddle pins as an input:
pinMode(leftpaddleopen, INPUT);
pinMode(rightpaddleopen, INPUT);
pinMode(leftpaddlepressed, INPUT);
pinMode(rightpaddlepressed, INPUT);
//park/reverse/neutral range selector switch input from trans connector pins n,r,p
pinMode(n, INPUT);
pinMode(r, INPUT);
pinMode(p, INPUT);
}
void loop() {
//prn range selector switch values read/write and logic check
rpnswitch[0] = digitalRead(n);
rpnswitch[1] = digitalRead(r);
rpnswitch[2] = digitalRead(p);
rangeswitchposition = rangeselector(rpnswitch[0], rpnswitch[1], rpnswitch[2]);
//if range selector reads drive read the state of the paddle value:
if (rangeswitchposition == 2) {
if (digitalRead(leftpaddlepressed == HIGH) && digitalRead(leftpaddleopen == LOW)) {
paddlestateleft = 1;
} else {
paddlestateleft = 0;
}
if (digitalRead(rightpaddlepressed == HIGH) && digitalRead(rightpaddleopen == LOW)) {
paddlestateright = 1;
} else {
paddlestateright = 0;
}
// check if the paddle is pressed.
paddlestates (paddlestateleft, paddlestateright);
}
}
// Functions
//tps input
int tpsvalue(int pin) {
int value;
value = analogRead(pin);
return value;//from 0-1023
}
//range selector array logic function
int rangeselector(boolean a, boolean b, boolean c) {
int selectorposition;
if (a == HIGH and (b == LOW and (c == HIGH))) {
selectorposition = 0;//P/N
}
if (a == LOW and (b == LOW and (c == HIGH))) {
selectorposition = 1;//R
}
if (a == LOW and (b == HIGH and (c == HIGH))) {
selectorposition = 5;//D1
}
if (a == HIGH and (b == HIGH and (c == HIGH))) {
selectorposition = 4;//D2
}
if (a == HIGH and (b == HIGH and (c == LOW))) {
selectorposition = 3;//D3
}
if (a == HIGH and (b == LOW and (c == LOW))) {
selectorposition = 2;//D
}
return selectorposition;
//0=P/N, 1=R, 2=D, 3=D3, 4=D2, 5=D1
}
//basic function for solenoid control table
int solenoidcontrol(int gear, int tps, boolean up, boolean down) {
boolean solA, solB, solC, tcc;
if (gear == 1) {
solA = 1;
solB = 1;
} if (gear == 2) {
solA = 0;
solB = 1;
} if (gear == 3) {
solA = 0;
solB = 0;
} if (gear == 4) {
solA = 1;
solB = 0;
}
return (solA, solB, solC, tcc);
}
boolean paddlestates (boolean paddlestateleftf, boolean paddlestaterightf) {
// check if the paddle is pressed.
// if it is, the paddleState is HIGH:
if (paddlestateleftf == HIGH && paddlestaterightf == LOW) {
// turn LED on:
downshift = HIGH;
delay(preshiftdelay);
} else {
// turn LED off:
downshift = LOW;
delay(postshiftdelay);
}
if (paddlestaterightf == HIGH && paddlestateleftf == LOW) {
// turn LED on:
upshift = HIGH;
delay(preshiftdelay);
} else {
// turn LED off:
upshift = LOW;
delay(postshiftdelay);
}
}
//functions end
sorry aboiut all that i finally figured it out lol
basically theres 3 solenoids and engaging a combination of them gives different gears, and later ill be coding to have the torque converter only lock up under heavy throttle or in 3 and fourth gears. also i would oinly like it to use the paddle shifters with the selector at D, since in 3,2 and 1 the transmission uses internal valves to control the gears and sets it to that gear. D would be like 4 on the selector (PRND321) and dont want it to control it in reverse or the others, i forget now but i think it was park and neutral that come up as the same. but those 3 wires (N,P,R coming off the trans link directly to the range selector switch and will have power at different oines to indicated where the selector is. the actual solenoid control isnt going to be quite like that i just wrote that from a shift table to help me visualize things, will be using a motor controller for that and will have to learn how to use those libraries. not sure if theres anyu other info youd need, ill be honest syntax and logic arent my strongpoints and im currently having issues with trying to make a cut down version with just the paddle buttons work....the leds will not turn off lmao