Error --Please solve

Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Avinash\OneDrive - hyderabad.bits-pilani.ac.in\Desktop\Correct_PaqariLab_2022\Correct_PaqariLab_2022.ino: In function 'void setup()':

Correct_PaqariLab_2022:23:2: error: 'TCCR1B' was not declared in this scope

23 | TCCR1B = TCCR1B & B11111000 | B00000001; // Changes pin 9 frequency to 3.1kHz

  |  ^~~~~~

exit status 1

'TCCR1B' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Correct_PaqariLab_2022.ino (6.2 KB)

Post you code inline here using code tags </>

// Script starts 
#include <Separador.h> 
Separador s; // Library to separate the obtained results from the smartphone 
// Circuit variables definition 
int a = 9; // PWM output pin, 254 resolution bits 
int ap = 10; // +5V supply for opamp 
int an = 7; // ICL7660 supply, turns +5V to -5V for opamp 
int a1 = 12; // ICL7660 supply, turns +5V to -5V 
int a2 = 2; // +5V for Bluetooth module 
int R2 = 330; // Used in operating potential window equation 
int R3 = 510; 
int R4 = 200; 
int val ; 
float ct = A0; // ADC analog input pin, 1024 resolution bits 
float c; // Current in bits 
float cc; 
// Redefinition of variables obtained from the smartphone 
float Estep; 
int t; 
int t_print; 
// 
void setup() { 
TCCR1B = TCCR1B & B11111000 | B00000001; // Changes pin 9 frequency to 3.1kHz 
Serial.begin(9600); 
pinMode(a,OUTPUT); // Output pin 
pinMode(a1,OUTPUT); 
pinMode(a2,OUTPUT); 
pinMode(ap,OUTPUT); 
pinMode(an,OUTPUT); 
pinMode(ct,INPUT); // Input pin, current lecture 
delay(2500); 
digitalWrite(an,1); // Negative supply of opamp 
digitalWrite(ap,1); // Positive supply of opamp 
delay(30000); 
digitalWrite(a2,1); // Bluetooth on 
delay(5000); // Time (ms) 
} 
// 
void loop() { 
if (Serial.available()){ 
String e = Serial.readString(); 
String e1 = s.separa(e,',',0); 
String e2 = s.separa(e,',',1); 
String e3 = s.separa(e,',',2); 
String e4 = s.separa(e,',',3); 
String e5 = s.separa(e,',',4); 
String e6 = s.separa(e,',',5); 
String e7 = s.separa(e,',',6);  

String e8 = s.separa(e,',',7); 
int ee1 = e1.toInt(); // E0 mV 
int ee2 = e2.toInt(); // Ei mV 
int ee3 = e3.toInt(); // Ef mV 
int ee4 = e4.toInt(); // Scan speed mV/s (vb) 
int ee5 = e5.toInt(); // Cycle number 
int ee6 = e6.toInt(); // Estep mV and time_step ms for chronoamperometry 
int ee7 = e7.toInt(); // Time of potential application 
int tech = e8.toInt(); // Electrochemical technique number 
float Eii = ee2/1000.0; // Input of initial V, the smaller value from -1.5V to 1.5 V 
float Ei = (Eii+(200.0/510.0)*4.70); // Transformation of the initial potential to Arduino 
int ti = Ei*(255.0/(5.5*(200.0/330.0))); 
float Ei0 = ee1/1000.0; 
float E0 = (Ei0+(200.0/510.0)*4.70); 
int start = E0*(255.0/(5.5*(200.0/330.0))); 
float Ef0 = ee3/1000.0; // Input of end potential, the greater number from -1.5V to 1.5 V 
float Ef = (Ef0+(200.0/510.0)*4.7); // Transformation of the end potential 
int fin = Ef*(255.0/(5.5*(200.0/330.0))); // Final potential, Arduino scale, Ei<Ef 
int vb = ee4; // Scan rate, mV/s, max = 1280 mV/s 
int const count = ee5; // Cycles number 
float Potstep = ee5/255.0; // Fixed due to the DAC resolution 
long t=(5000000L)/(256L*vb); 
int time_tot = ee7*-1000; // Time (ms) 
int tot_time = time_tot/ee6; 
int val; 
// Electrochemical methods 
switch (tech){ 
// ------ Chronoamperometry------ 
case 1: 
digitalWrite(a1,1); 
for(int n = 1; n < tot_time; n++){ 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(ti); 
Serial.print(";"); 
analogWrite(a,ti); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(n*ee6); 
Serial.print(";"); 
Serial.println(cc); 
int sec = ee6*1000; 
delay(sec); 
} 
break; 
// ------Linear voltammetry------ 
case 2: 
digitalWrite(a1,1); 
// Anodic scan 
if (Ei < Ef) { 
for(int n = 1; n <= count; n++){ 
for(int val = ti; val < fin; val++){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 

Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 
} 
} 
// Cathodic scan 
else if (Ei >= Ef) { 
digitalWrite(a1,1); 
for(int n = 1; n <= count; n++){ 
for(int val = ti; val > fin; val--){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 
} 
} 
break; 
// ------Cyclic voltammetry------ 
case 3: 
digitalWrite(a1,1); 
// Anodic scan 
if (Ei < Ef) { 
for(int n = 1; n <= count; n++){ 
// Start the forward scan 
for(int val = ti; val < fin; val++){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 

// Start the reverse scan 
for(int val = fin; val > start; val--){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 
ti = start; 
} 
} 
// Cathodic scan 
else if (Ei >= Ef) { 
for(int n = 1; n <= count; n++){ 
//Start the forward scan 
for(int val = ti; val > fin; val--){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 
//Start the reverse scan 
for(int val = fin; val < start; val++){ 
analogWrite(a,val); 
Serial.print("#c"); 
Serial.print(1); 
Serial.print(";"); 
Serial.print(val); 
Serial.print(";"); 
c = analogRead(ct); 
cc = (0.472*(analogRead(ct))-226.1); 
Estep = (1.843-(val*0.014379)); 
Serial.print(c); 
Serial.print(";"); 
Serial.print(Estep); 
Serial.print(";"); 
Serial.println(cc); 
delay(t); 
} 
ti=fin; 
} 
} 

break; 
} 
} 
} 
//Script ends

Your code is for AVR chips, it is not compatible with the ESP boards

Using Uno code for a ESP9266 will not work.

Your topic has been moved to a more suitable location on the forum as this has nothing to do with Avrdude, stk500 or Bootloader.

The ESP8266 does not have AVR timer hardware so the timer hardware registers are not defined. You will need to remove the processor-specific parts of the sketch to make it compatible with the ESP8266.

Your headline

Error –Please solve

is extremely short and extremely demanding.

For your next question you should write your question in your native language with about 7 to 15 words that nail your problem spot-on and then let do google-translate do the translation from your native language to english

best regards Stefan

1 Like

Just comment out this line. All it does on an Arudino UNO/Nano is change the PWM frequency on two of the PWM output pins. If you need to do that on the ESP8266 you will have to do some research but for now it will probably work.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.