Go Down

Topic: then //How do you declare “then” in this scope? (Read 1 time) previous topic - next topic

INTP

Troll or very 'analogWrite(ledPin, 1); //active high LED' individual.

johnwasser

// How do you declare "then" in this scope?...  This is "hung up" on switchPin 5
You don't.
Since you don't know how to program and have said that you don't want to learn and you can't pay someone to do the programming you are in for a heap of trouble.  You seem to be typing in nearly random strings of symbols and then asking how to fix your code.
I have fixed your code to make it compile.  This involved adding some missing declarations, adjusting the symbols to match the apparent intent, and commenting out several lines of complete nonsense, particularly the use of "then".  Your code still does nothing but at least it compiles with only warnings, not errors.  :)
Code: [Select]
boolean switchPin2, switchPin3, switchPin4, switchPin5, switchPin6,  switchPin7;
void setup() {
  unsigned long previousTime = 1520;
  int switchState = 1520;
  int prevSwitchState = 1520;
  int Time = 2;
  long interval = 1;
  for (int x = 2; x < 8; x++) {
    pinMode(x, OUTPUT);
  }
  // int switchPin = pinMode;
  // int then();
  // then == switchPin;
  if (digitalRead(A0) == HIGH)
    switchPin7 = HIGH;
  if (digitalRead(A1) == HIGH)
    switchPin6 = HIGH;
  if (digitalRead(A2) == HIGH)
    switchPin2 = HIGH;
  if (digitalRead(A3) == HIGH)
    switchPin3 = HIGH;
  if (digitalRead(A4) == HIGH)
    switchPin4 = HIGH;
  if (digitalRead(A5) == HIGH)
    switchPin5 = HIGH;
}
void loop() {
  unsigned long currentTime = millis();
  int Time = 2;
  long interval = 1;
}
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

johnwasser

Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

lastchancename

Very generous @johnwasser
I'm not entirely sure if the OP is a troll or not, but certainly needs a lot of help understanding the very basics.
Should send him off to Arduino kindergarten ASAP
Q: How many searches did you make before posting this question?      A: none
At the very least, take a guess at the solution, then we can help move forward from what you know already.

UKHeliBob

Quote
if (digitalRead(A1) = HIGH);
 {
   switchPin 6 == HIGH;
 }
Should be:
 if (digitalRead(A1) == HIGH);  <-----<<<<< two =
 {
   switchPin 6 = HIGH; <-----<<<<< one =
 }
Should be
Code: [Select]

if (digitalRead(A1) == HIGH)  //no semicolon at the end of the statement
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Robin2

I smell a troll.
+1

In this Thread the OP said " I spent my adult life in Silicon Valley;" and it is very difficult to imagine how anyone with a professional knowledge of computing (no matter how long ago) could ask questions like in this Thread.

Of course he might have been selling doughnuts to the geeks.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

johnwasser

In this Thread the OP said " I spent my adult life in Silicon Valley;" and it is very difficult to imagine how anyone with a professional knowledge of computing (no matter how long ago) could ask questions like in this Thread.

Of course he might have been selling doughnuts to the geeks.
If you look at the LinkedIn link I posted you will see that he was supervising the HVAC technicians and other facilities maintenance people.  May never have talked to a programmer in his 36-year career.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Robin2

May never have talked to a programmer in his 36-year career.
That figures. But then his reference to his time in Silicon Valley was misleading. I have no idea whether that was intentional, but it was certainly careless.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

JackOWalden1Sr

// Its Hard Teaching an Old Dog New Tricks. Thanks John for checking on me. Also, thanks for all input.
// Please see attachments...the intent is to place this, as a working file, into the Microcontroller.
Code: [Select]

void setup() {
unsigned long previousTime = 848;
int switchState = 152;
int prevSwitchState = 848; // Not sure of these 3 lines...the intent is to time the outputs a small fraction of a second.
int Time = 1;
long interval = 1;
for (int x = 1; x < 8; x++) { // Not sure of these 3 lines either...see above…please explain "x+++...MS language?
  pinMode(x, OUTPUT);
}
int switchPin = pinMode;
int then();
then = switchPin;
if (digitalRead(A0) = HIGH);
{
  switchPin 7 == HIGH;
}
if (digitalRead(A1) = HIGH);
{
  switchPin 6 == HIGH;
}
if (digitalRead(A2) = HIGH);
{
  switchPin 2 == HIGH;
}
if (digitalRead(A3) = HIGH);
{
  switchPin 3 == HIGH;
}
if (digitalRead(A4) = HIGH);
{
  switchPin 4 == HIGH
}
if (digitalRead(A5) = HIGH);
{
  switchPin 5 == HIGH;
}
void loop() {
  unsigned long currentTime = millis();
  int Time = 2;
  long interval = 1;
}

aarg

Code: [Select]
if (digitalRead(A0) = HIGH);
{
  switchPin 7 == HIGH;
}


You have the proper use of = and == reversed.

So it can't be "a working file".
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

larryd

Please, this has been mentioned many times now!

if (digitalRead(A0) = HIGH);
{
switchPin 7 == HIGH;
}

Should Be!

if (digitalRead(A0) == HIGH);
{
switchPin 7 = HIGH;
}

An old dog should be able to still read ;)

Read this:
https://www.arduino.cc/en/Reference/Assignment

And read this:
https://www.arduino.cc/en/Reference/If

No technical PMs.
The last thing you did is where you should start looking.

larryd

// Not sure of these 3 lines either...see above…please explain "x+++

x++   <-----<<<<< is the same as   x = x +1


for (int x = 1; x < 8; x++)
{ // Not sure of these 3 lines either...see above…please explain "x+++...MS language?
  pinMode(x, OUTPUT);
}

This is making pins 1-7 OUTPUT pins.
This is your code after all.
No technical PMs.
The last thing you did is where you should start looking.

UKHeliBob

There is so much wrong with the program that it is difficult to know where to start so let's start with the loop() function

Code: [Select]

  void loop()
  {
    unsigned long currentTime = millis();
    int Time = 2;
    long interval = 1;
  }

What is it supposed to do apart from declaring and initialising 3 variables that are local to the function so will not be available anywhere else in the program, not that any other code will be executed anyway.

Another simple question.  Where is the end of the setup() function ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

JackOWalden1Sr

// Its Hard Teaching an Old Dog New Tricks. Thanks John for checking on me. Also, thanks for all input.
// Please see attachments...the intent is to place this, as a working file, into the Microcontroller.
// My ignorance, I started with 2 OP programs, had to start somewhere...hopefully, see new attachment.

void setup() {
unsigned long previousTime = 848;
int switchState = 152;
int prevSwitchState = 848; // Not sure of these 3 lines...the intent is to time the outputs a small fraction of a second.
int Time = 1;
long interval = 1;
for (int x = 1; x < 8; x++) { // Not sure of these 3 lines either...see above…please explain "x+++...MS language?
  pinMode(x, OUTPUT);
// Maybe the OUTPUT pins will work.
}
int switchPin = pinMode;
int then();
then = switchPin;
if (digitalRead(A0) == HIGH);
{
  switchPin 7 = HIGH;
}
if (digitalRead(A1) == HIGH);
{
  switchPin 6 = HIGH;
}
if (digitalRead(A2) == HIGH);
{
  switchPin 2 = HIGH;
}
if (digitalRead(A3) == HIGH);
{
  switchPin 3 = HIGH;
}
if (digitalRead(A4) == HIGH);
{
  switchPin 4 = HIGH
}
if (digitalRead(A5) == HIGH);
{
  switchPin 5 = HIGH;
}
void loop() {
  // The intent is to run the above program.
}

AWOL

Code: [Select]
if (digitalRead(A2) == HIGH);Lose the semicolon.
Use code tags.
Make sure you've got enough { and }, in the right places
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up