This code
// Include the AccelStepper Library
#include <AccelStepper.h>
// Creates an instance
// Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence
AccelStepper myStepper(AccelStepper::FULL4WIRE, 4, 6, 5, 7);
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxx";
char pass[] = "xxxxxxxxx";
// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
void setup()
{
Serial.begin(9600);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
}
BLYNK_WRITE(V0) // Slider in V0
{
int cup_slider = param.asInt();
// set the maximum speed, acceleration factor,
// initial speed and the target position
if (cup_slider = param.asInt()== 1)
{
myStepper.setMaxSpeed(1000.0);
myStepper.setAcceleration(100.0);
myStepper.setSpeed(100.0);
myStepper.moveTo((cup_slider) * 2048ul);
// aqui serve para setar o numero de voltas que o motor
// vai dar, então no caso é melhor que marcar o tempo
// em minutos 1 volta=2038
}
void loop(){
{
// Move the motor one step each time through loop()
myStepper.run();
Serial.println(myStepper.currentPosition());
}
}
make me an error
C: \ Users \ gabri \ OneDrive \ test_motorzin \ mano_for_testing_motor \ motor_of_variables_voltas.ino: In function 'void BlynkWidgetWrite0 (BlynkReq &, const BlynkParam &)':
motor_da_varias_voltas: 64: 12: error: a function-definition is not allowed here before '{' token
void loop () {
^
motor_da_varias_voltas: 70: 1: error: expected '}' at end of input
}
^
Multiple libraries were found for "BlynkSimpleShieldEsp8266.h"
Used: C: \ Users \ gabri \ OneDrive \ Documents \ Arduino \ libraries \ Blynk
Not used: C: \ Users \ gabri \ OneDrive \ Documents \ Arduino \ libraries \ blynk-library-master
exit status 1
a function-definition is not allowed here before '{' token
but I don’t know exactly where I’m wrong, another thing I’d like to ask is if anyone knows how I can use the value that comes out of BLYNK_WRITE (V0) (which is a slider in the blynk app) to pass to cup_slider and thus be able to multiply by 2048 down there
thank you very much for your attention, and forgive the "silly" doubts