Can't get anything to work

I've always had trouble getting drivers to work but now I can't make anything work on any computer any board. I have painted myself into a corner I have made a water treatment system but I need the controller programmed I've been trying for two mounth solid on this last attemptI need to get my code uploaded to a nano but I'm out of gas I need to get my contaminatedf water fixed and this nano is the heart of it. I've tried everything I could find on the web and I'm giving up. I need someone to load the code onto a nano for me. maybe it's my brain or maybe it's my computer i don't know i only know that i can't do it. there 9is no one near me that i can find that knows anything about arduino I'm willing to pay someone to load a nano for me. I woulkd rather have someone show me where the disconect is but i'm not holding my breath. I'm getting older and I'm not as sharp as I was just 6 months ago. my doctor tells me there is nothing wrong with me but i know that's not true. I have up loaded to an uno recently but can no longer do that either. I used to be able to upload to a nano until they started putting the ch340 chip in them. and aparently i did manage to upload to a nano with a ch340 because i found one with working code in it but it wasn't compatable with my current circuit configuration and it had to be adjusted by changing the code and re-uploading so that won't work the code needs to be adjusted after uploading
i have the board built after 12 tries I can't believe i failed at such a simple circuit so many times. but it is built but i can't test it untill the code is loaded on the board here is my code, it may still have some bugs in it but it's mostly done:
could not upload so i could not test the lcd library I need to print to an lcd display 16x2 i2c to show the user what the settings for psi is and what the reading is it uses two float sensors one to tell if the first tank is not full to open a valve to fill it where it gets treated with ozone and one float sensor to be sure there is clean water available to pump into the presure tank

I have not been able to test the lcd library to make sure it will work with my screens so this is all i have

#include <LiquidCrystal.h>

//John Laramie jjohn.laramie@gmail.com

//Thu, Jul 20, 3:56 AM (4 days ago)

// this sketch is written for a water treatment system made by john laramie in 2023

// pins used

int ozone=1,led1=2,float1=4,valve=6, float2=7,led2=8,psi=A0,but1=A1,but2=A2,pump=12;

//varibles

int psiref=0,psilow=0,ozoneOn=0,but1was=0,but2was=0,float1was=0,float2was=0,alarm=0,pumping=0;

int fill=0;

unsigned long ozstart=0,fillst=0,ozrun=0,fillrun=0,min1=60000,min20=1200000,pumpst=0;

void setup(){tp0();tp1();tp2();tp9();ozstart=millis();pu(but1);pu(but2);pu(float1);pu(float2);out(ozone);out(valve);out(pump);out(led1);

out(led2);Serial.begin(9600);}

//led1 indicates tank1 not full and filling

//led2 indicates presure in presure tank is low and pump will be pumping if water is in tank2

void loop(){ptank():tank1();buts();if(alarm>0){led11();led21();if (alarm==1){delay(75);led00();}

if(alarm==2){delay(20);led00();} } }

void tp0(){}

void tank1(){if(millis();>fillst+min20){if (fill==1){

dw(valve,0);fill=0;dw(led1,0);fillst=millis();}else{

dw(valve,1);fill=1;dw(led1,1);fillst=millis();}

if(dr(float1)==0) {//tank is full of water make sure valve is closed.if(alarm==1)alarm=0;

dw(valve,0);dw(led1,0);fill=0;}else{// tank not full open valve and record time

dw(valve,1);dw(led1,1);if(fill==0){fillst=millis();fill=1;}} }}

void tp9(){}

void pu(int pin){pinMode(pin,INPUTPULLUP);}

void out(int pin){pinMode(OUTPUT);}

int dr(int pin){int d=0;d= digitalRead(pin);return d;}

void dw(int pin,int d){digitalWrite(pin,d);}

int ar(int pin,int d){int d=0;d=analogRead(pin);return d;}

int buts(){int but=0;if(dr(but1)==0){if(but1was==1){psiref++;psich();}but1was=0;}else{but1was=1;}

if(dr(but2)==0){if(but2was==1){psiref--;psich();}but2was=0;}else{but2was=1;}}

void tp1(){}

void led11(){dw(led1,1);}

void led10 (){dw(led1,0);}

void led21(){dw(led2,1);}

void led20 (){dw(led2,0);}

void led00 (){dw(led1,0);dw(led2,0);}

void tp2(){}

void ptank(){

if (pumping==1){if(millis();>pumpst+2*min20){alarm=2;pumpoff();}

if(ar(psi)<psiref){if(dr(float2)==0){if(pumping==0){pumpst=millis();dw(pump,1);pumping=1;led21();} }else{

pumpoff();} }else{

pumpoff();} } } }

void pumpoff(){dw(pump,0);pumping=0;led20();}

//void psich(){Serial.print("psiref=");Serial.print(psiref);Serial.print("psi=");Serial.print(psi);lf();}

I also wanted to add some code to keep some stats on how long everything ran per day to get an idea over time how much water I'm using but if i can't upload there is no way to guess at a working code that would do this. it is like a blind man trying to show another blind man around the forrest i have no way to test anything so i don't even know if I am even using a computer or if it's all in my imagination things are so weird to me now that I'm not even wsure I'm still alive or if this is a hellish punishment designed just for me. electronics have been my whole life long hobby my only interest and now I am un able to do anything with it. I was looking forward to having the time and money and space to build all kinds of projects at this time of my life and just in the last six months all my abilities have been lost. I need someone to help me find out where the disconect is so i can Maybe fix it.or maybe I'm condemed to live the rest of my life with all my dreams just out of reach.
no wait something happened to it is is corrupted some how
i thought this was happening to my code when i was trying to use linux so i came back to windows and i see it is still happening.
all i know is that i need help and no body i know can help me I need to get this working before i completely loose my mind
nobody here will ever figure out what i did or what i need i don't know maybe my reality is distorted I have no way of knowing if i'm making any sense or not. but nobody here can understand my problem. they say" why don't you put it back the way you found it ".and my answer is because i made this system from parts there was no system until i made one but i can't get it working until i get this code uploaded.so it's just a 2 thousand dollar pile of trash with a ton of concrete at it's base. it will have to be riped out and i will have sewage water on tap for the rest of my life I tried to build a board with discrete components to handle it. i can design the circuit but can't build the board I tried many times. the only reason i was able to build this one is because i used a microprocessor. it as you know makes the construction of devices so much simpler. can someone please help me? i live in sonoma county california and can't find anyone with any knowledge of electronics even. i used to work in silicon valley but that was some time ago I'm not going to paste my sketch again it got scrambled somehow when i did that last time
I really need to find out where the problem is, it could be with my ability to preceive reality because nothing makes any sense anymore but i do need to make this work for my health. I would like to continue using arduino but it looks like I'm done with it because nothing works for me anymore I need help
I need this one last project to work even if i'm not the one to program it
there has to be a way to get these things to up load. i mean you guys are still able to use them right? why am i not allowed to use them anymore

By formatting the code in this way, you not only make it difficult for others to read it, but also confuse yourself, which is why errors like this appear:

Start by formatting your code with the key combination Ctrl-T in IDE and post the corrected code as a new message using the code tags.

2 Likes

Addtional provide a short form of the task description.

Use punctuation to structure the text simply.

2 Likes

Hi, @jjohn.laramie_gmail.com
Welcome to the forum.

What controller are you using?

Can you please tell us your electronics, programming, arduino, hardware experience?

What version IDE are you using?
What OS are you using?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:
PS. Your code does not appear to compile.

1 Like

I would suggest you start with the basics, and open up the blink sketch from the menu File -> Examples -> 01.Basics -> blink

Select the Nano board from the menu Tools -> board
and select the appropriate port from the menu Tools -> Port

And try and upload it to your Nano. Right facing arrow second icon from the window.

Then post back what happens in terms of error messages or what ever happens.

2 Likes

Your stress level is very high and its well known that ones ability to perform complicated functions is diminished under these conditions.

You need to break the problem down, and find where the real problem lies. Is your computer working properly? Can you upload and run a simple example sketch on the nano?

If you can establish your hardware is working properly its time to move on to your code.

2 Likes

Hi,
Is this a commercial project?
Are you getting payed for it ?
Have you got a schematic of your project?
Have you got a basic description of what your project is supposed to do?

A flowchart may help.

Tom... :smiley: :+1: :coffee: :australia:
PS, 66yo here asking how old you are?

1 Like

Clone manufacturers have been using CH340s in their designs for ages. However, there nowadays seem to be fake CH4340s around. Consider buying a real Nano.

Further

  • Anything connected to pins 0 and 1 of the Nano (except for the standard TTL-to-USB converter)?
  • Which version of the IDE?
  • Do you have he exact same problem in Linux and Windows? Or different errors?
  • The full error message; for IDE 1.x use the copy "error messages" button, for IDE 2.x right click in the output pane and use "copy all". Paste it here using code tags.

I assume because you did not use code tags. The IDE has a menu item "copy for forum"; use that and paste here.

1 Like

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

The easiest way is to use Edit/Copy for Forum in the IDE and paste it here. Code tags will automatically have been added

As to your problem, which Processor have you got selected in Tools/Processor in the IDE ?

Try the other ATMega 328P option

2 Likes

now back to my original problem. It will not upload
tried replacing drivers and everything else i can find but nothing works
using ver 2.1.1 to nano with the ch340 chip
FQBN: arduino:avr:nano:cpu=atmega328old
Using board 'nano' from platform in folder: C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp" -o nul
Alternatives for LiquidCrystal.h: [LiquidCrystal@1.0.7]
ResolveLibrary(LiquidCrystal.h)
-> candidates: [LiquidCrystal@1.0.7]
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp" -o nul
Using cached library dependencies for file: C:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src\LiquidCrystal.cpp
Generating function prototypes...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp" -o "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp" -o "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp.o"
Compiling libraries...
Compiling library "LiquidCrystal"
Using previously compiled file: C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\libraries\LiquidCrystal\LiquidCrystal.cpp.o
C:\Users\jlaramie\Documents\Arduino\maycleanwater\maycleanwater.ino: In function 'void vcc(int, int)':
C:\Users\jlaramie\Documents\Arduino\maycleanwater\maycleanwater.ino:20:23: warning: unused parameter 'd' [-Wunused-parameter]
void vcc(int pin, int d) {
^
Compiling core...
Using precompiled core: C:\Users\jlaramie\AppData\Local\Temp\arduino\cores\arduino_avr_nano_cpu_atmega328old_8cb2a48c2db8e2fc5f76a4ca617f0628\core.a
Linking everything together...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.elf" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\sketch\maycleanwater.ino.cpp.o" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2\libraries\LiquidCrystal\LiquidCrystal.cpp.o" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/..\..\cores\arduino_avr_nano_cpu_atmega328old_8cb2a48c2db8e2fc5f76a4ca617f0628\core.a" "-LC:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2" -lm
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.elf" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.eep"
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.elf" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.hex"

Using library LiquidCrystal at version 1.0.7 in folder: C:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.elf"
Sketch uses 3218 bytes (10%) of program storage space. Maximum is 30720 bytes.
Global variables use 228 bytes (11%) of dynamic memory, leaving 1820 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM3" -b57600 -D "-Uflash:w:C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\9D39A7BCCFA677D2CA688F4F90C9F7A2/maycleanwater.ino.hex:i"

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM3
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x02
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xfe
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x02
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x82
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x02
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x82

avrdude done. Thank you.

Failed uploading: uploading error: exit status 1

I'm sorry I don't know how to format my post how do i do that?

Start by clicking the <code/> button ; you will get this
image

Paste you error message over the highlighted text.

A post was merged into an existing topic: Will not upload

#include <LiquidCrystal.h>

//John Laramie <jjohn.laramie@gmail.com>

//Thu, Jul 20, 3:56 AM (4 days ago)

// this sketch is written for a water treatment system made by john laramie in 2023

// pins used
int ozone = 1, led1 = 2, float1 = 4, valve = 6, float2 = 7, led2 = 8, psi = A0, but1 = A1, but2 = A2, pump = 12;
//varibles
int psiref = 0, psilow = 0, ozoneOn = 0, flt1cnt = 0, but1was = 0, full = 0, but2was = 0, float1was = 0, float2was = 0, alarm = 0, pumping = 0;
int fill = 0;
unsigned long ozstart = 0, fillst = 0, ozrun = 0, fillrun = 0, min1 = 60000, min20 = 1200000, pumpst = 0;


void setup() {
  tp0();
  tp1();
  tp2();
  tp9();
  ozstart = millis();
  pu(but1);
  pu(but2);
  pu(float1);
  pu(float2);
  out(ozone);
  out(valve);
  out(pump);
  out(led1);
  out(led2);
  Serial.begin(9600);
}
//led1 indicates tank1 not full and filling
//led2 indicates presure in presure tank is low and pump will be pumping if water is in tank2


void loop() {
  if (drfloat1)==0){
      flt1cnt++;
      if (flt1 == 20) full = 1;
    }
  else {
    flt1--;
    if (flt == -10) full = 0;
  }
  o3();
  ptank();
  tank1();
  buts();
  if (alarm > 0) {
    led11();
    led21();
    if (alarm == 1) {
      delay(75);
      led00();
    }
    if (alarm == 2) {
      delay(20);
      led00();
    }
  }
}
void tp0() {}
void o3() {
  if (millis(); > ozstart + min20) {
    if (ozoneO == 1) {
      dw(ozone, 0);
      ozoneO = 0;
    } else {
      dw(ozone, 1);
      ozoneO = 1;
    }
  }
  void tank1() {
    if (full == 0) {
      dw(valve, 1);
      fill = 1;
      dw(led1, 1);
    } else {
      dw(valve, 0);
      dw(led1, 0);
      fill = 0;
    }
  }
  void tp9() {}


  void pu(int pin) {
    pinMode(pin, INPUTPULLUP);
  }
  void out(int pin) {
    pinMode(OUTPUT);
  }
  int dr(int pin) {
    int d = 0;
    d = digitalRead(pin);
    return d;
  }
  void dw(int pin, int d) {
    digitalWrite(pin, d);
  }
  int ar(int pin, int d) {
    int d = 0;
    d = analogRead(pin);
    return d;
  }
  int buts() {
    int but = 0;
    if (dr(but1) == 0) {
      if (but1was == 1) {
        psiref++;
        psich();
      }
      but1was = 0;
    } else {
      but1was = 1;
    }
    psich();
  }
  if (dr(but2) == 0) {
    if (but2was == 1) {
      psiref--;
      psich();
    }
    but2was = 0;
  } else {
    but2was = 1;
  }
}

void tp1() {}
void led00() {
  dw(led1, 0);
  dw(led2, 0);
}
void tp2() {}
void ptank() {
  if (pumping == 1) {
    if (millis(); > pumpst + 2 * min20) {
      alarm = 2;
      pumpoff();
    } else {
      if (ar(psi) < psiref) {
        if (dr(float2) == 0) {
          dw(pump, 1);
          pumping = 1;
          pumpst = millis();
        }
        if (dr(float2) == 1) {
          dw(pump, 0);
          pumping = 0;
          dw(led2, 0);
        }
      } else {
        pumpoff();
      }
    }
  }
}
}
}
}
void pumpoff() {
  dw(pump, 0);
  pumping = 0;
  dw(led2, 0);
}

//void psich(){Serial.print("psiref=");Serial.print(psiref);Serial.print("psi=");Serial.print(psi);lf();}

adruino 2.1.1 windows10 trying to upload to a nano with the ch340 chip

no i can't even upload a blank sketch

okay now I know what that is for thank you

#include <LiquidCrystal.h>

//John Laramie <[jjohn.laramie@gmail.com](mailto:jjohn.laramie@gmail.com)>

//Thu, Jul 20, 3:56 AM (4 days ago)

// this sketch is written for a water treatment system made by john laramie in 2023

// pins used
int ozone = 1, led1 = 2, float1 = 4, valve = 6, float2 = 7, led2 = 8, psi = A0, but1 = A1, but2 = A2, pump = 12;
//varibles
int psiref = 0, psilow = 0, ozoneOn = 0, flt1cnt = 0, but1was = 0, full = 0, but2was = 0, float1was = 0, float2was = 0, alarm = 0, pumping = 0;
int fill = 0;
unsigned long ozstart = 0, fillst = 0, ozrun = 0, fillrun = 0, min1 = 60000, min20 = 1200000, pumpst = 0;

void setup() {
tp0();
tp1();
tp2();
tp9();
ozstart = millis();
pu(but1);
pu(but2);
pu(float1);
pu(float2);
out(ozone);
out(valve);
out(pump);
out(led1);
out(led2);
Serial.begin(9600);
}
//led1 indicates tank1 not full and filling
//led2 indicates presure in presure tank is low and pump will be pumping if water is in tank2

void loop() {
if (drfloat1)==0){
flt1cnt++;
if (flt1 == 20) full = 1;
}
else {
flt1--;
if (flt == -10) full = 0;
}
o3();
ptank();
tank1();
buts();
if (alarm > 0) {
led11();
led21();
if (alarm == 1) {
delay(75);
led00();
}
if (alarm == 2) {
delay(20);
led00();
}
}
}
void tp0() {}
void o3() {
if (millis(); > ozstart + min20) {
if (ozoneO == 1) {
dw(ozone, 0);
ozoneO = 0;
} else {
dw(ozone, 1);
ozoneO = 1;
}
}
void tank1() {
if (full == 0) {
dw(valve, 1);
fill = 1;
dw(led1, 1);
} else {
dw(valve, 0);
dw(led1, 0);
fill = 0;
}
}
void tp9() {}

void pu(int pin) {
pinMode(pin, INPUTPULLUP);
}
void out(int pin) {
pinMode(OUTPUT);
}
int dr(int pin) {
int d = 0;
d = digitalRead(pin);
return d;
}
void dw(int pin, int d) {
digitalWrite(pin, d);
}
int ar(int pin, int d) {
int d = 0;
d = analogRead(pin);
return d;
}
int buts() {
int but = 0;
if (dr(but1) == 0) {
if (but1was == 1) {
psiref++;
psich();
}
but1was = 0;
} else {
but1was = 1;
}
psich();
}
if (dr(but2) == 0) {
if (but2was == 1) {
psiref--;
psich();
}
but2was = 0;
} else {
but2was = 1;
}
}

void tp1() {}
void led00() {
dw(led1, 0);
dw(led2, 0);
}
void tp2() {}
void ptank() {
if (pumping == 1) {
if (millis(); > pumpst + 2 * min20) {
alarm = 2;
pumpoff();
} else {
if (ar(psi) < psiref) {
if (dr(float2) == 0) {
dw(pump, 1);
pumping = 1;
pumpst = millis();
}
if (dr(float2) == 1) {
dw(pump, 0);
pumping = 0;
dw(led2, 0);
}
} else {
pumpoff();
}
}
}
}
}
}
}
void pumpoff() {
dw(pump, 0);
pumping = 0;
dw(led2, 0);
}

//void psich(){Serial.print("psiref=");Serial.print(psiref);Serial.print("psi=");Serial.print(psi);lf();}

wow you haven't said much but you have already taught me a lot I should have come here sooner but I never understood how to use the forum and still don't but I think it's helping fast thank you still confused on posting and how to find replies

Have you tried the alternative Processor option as suggested in reply #10 ?

1 Like

Hi @jjohn.laramie_gmail.com,

Have you installed Windows 10 driver for the ch340 chip?
See How to Install CH340 Drivers for Widows 7/10

HTH?

1 Like

yes tried that before too but just did it again and still not workingFQBN: arduino:avr:nano:cpu=atmega328old
Using board 'nano' from platform in folder: C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\sketch\cleanwater_02.ino.cpp" -o nul
Alternatives for LiquidCrystal.h: [LiquidCrystal@1.0.7]
ResolveLibrary(LiquidCrystal.h)
-> candidates: [LiquidCrystal@1.0.7]
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\sketch\cleanwater_02.ino.cpp" -o nul
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src\LiquidCrystal.cpp" -o nul
Generating function prototypes...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\sketch\cleanwater_02.ino.cpp" -o "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\jlaramie\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs" "-IC:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal\src" "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\sketch\cleanwater_02.ino.cpp" -o "C:\Users\jlaramie\AppData\Local\Temp\arduino\sketches\C319261369BF1557A82B27AA39627FFD\sketch\cleanwater_02.ino.cpp.o"
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino: In function 'void setup()':
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino:18:3: error: 'pu' was not declared in this scope
pu(but1);
^~
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino:18:3: note: suggested alternative: 'pump'
pu(but1);
^~
pump
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino:22:3: error: 'out' was not declared in this scope
out(ozone);
^~~
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino:22:3: note: suggested alternative: 'but2'
out(ozone);
^~~
but2
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino: At global scope:
C:\Users\jlaramie\Documents\Arduino\cleanwater_02\cleanwater_02.ino:33:1: error: expected declaration before '}' token
}
^

Using library LiquidCrystal at version 1.0.7 in folder: C:\Users\jlaramie\AppData\Local\Arduino15\libraries\LiquidCrystal
exit status 1

Compilation error: 'pu' was not declared in this scopeI have no idea what is going on