texts: Where to define web server callback functions so they can access server object? (ESP8266WebServer library)

texts:
I want my ESP8266-based device to create an accesspoint that allows the user to input their home ssid and password. There is a device object that holds most of the data defined elsewhere.
I'm trying to use the ESP8266WebServer library. It requires me to define parameterless callback functions. Where should I declare and define these callback functions so that they can access the server object? In all the example code, the server object is global. I'd want to avoid that, and I'd also like to avoid having a server object as a permanent Device class member.
How should I go about this? It is not allowed to define the callback functions inside Device::getWifiCredentials, and if I declare them outside then server isn't in scope.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

// Function to create AccessPoint to get ssid and password
int Device::getWifiCredentials() {

    ESP8266WebServer server(80);
    server.begin();

    // define callbacks
    server.on("/", handleRoot); // initial page

    server.on("/ssid", handleCredentials); // catch response from initial page

    // wait for credentials to be delivered
    server.handleClient();

    while( WiFi.status() != WL_CONNECTED){
        Serial.print(".");
        delay(500);
    }

    return ACTION_SUCCESSFUL;

}

// **Where can these functions be defined to allow them to access the server object?**

void handleRoot() {
};

void handleCredentials() {

    String ssid;
    String pw;

    if( server.hasArg() ){
        ssid = server.arg("ssid");
        pw = server.arg("pw");
    }
};


texts:
I am using an Arduino due and have multiple schedules running at the same time. I am using this Library.

I have a function that 3 different loops use. Two of the loops are driven by user interaction so timing is not possible. The function does reset global variables and I would have no issue with the variables being reset multiple times as it wouldn't cause any problems for me.

What I was wondering, on the very slim chance that two loops called the function at the same time, is it possible for the loops to modify the same variable at identical times?

My understanding of the scheduler would lead me to believe that the scheduler will only yield to another loop after it has completed a line of code and thus the to instructions to reset the global variable could not happen at the very same time, just extremely quickly one after the other.

Would this be a correct assumption?


texts: Can I use a "Funduino Uno" arduino with power from a power bank with DC 5V 1A output?


texts: how to wrire into the contents of the registers in ADMV1013 up converter using arduino Due?

texts:
There are nine registers inside and the contents of the registers can be changed to perform several operations. The link of the data-sheet is given here(Page 26). The write cycle sampling must be performed on the rising edge.
The 16 bits of the serial write data are shifted in, MSB to lower
sideband.
The link: https://www.analog.com/media/en/technical-documentation/data-sheets/ADMV1013.pdf


texts: amblone error :85: error: 'TCCR3B' was not declared in this scope - no fullscreen vlc support

texts:
getting the following error when trying to upload Amblone code to my Arduino One board:

Arduino: 1.6.12 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\pha\Desktop\amblone\amblone.pde: In function 'void setup()':

amblone:85: error: 'TCCR3B' was not declared in this scope

   TCCR3B = TCCR0B & 0b11111000 | 0x2;

   ^

amblone:86: error: 'TCCR4B' was not declared in this scope

   TCCR4B = TCCR0B & 0b11111000 | 0x2;

   ^

exit status 1
'TCCR3B' was not declared in this scope

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe1
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

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

Code:

void setup()   {
  // initialize the serial communication
  Serial.begin(256000); // opens serial port, sets data rate to 256000 bps

  TCCR0B = TCCR0B & 0b11111000 | 0x2;
  TCCR1B = TCCR0B & 0b11111000 | 0x2;
  TCCR2B = TCCR0B & 0b11111000 | 0x2;
  TCCR3B = TCCR0B & 0b11111000 | 0x2;
  TCCR4B = TCCR0B & 0b11111000 | 0x2;

  State = S_WAIT_FOR_SF;
}


texts: A question on physical locations of the registers in ATmega328P

texts:
When I read about registers I always encounter the following illustration:

So there are 32 registers in the above diagram. They are processor registers.

But in the data-sheet of ATmega328P at page 428 there is a section called "Register Summary".

Here in that list there are much more than 32 registers. Do the rest of the registers physically stay somewhere else?

Lest's take an example of ADMUX register. Where is that register physically inside the DIP? It is not one of the 32 registers? And if stays somewhere else how does it connected to the ALU?


texts:
So I started working on a project of mine that is mostly software based which I have no problems with, but it includes electronics too. Where I am still learning a lot. Anyways, I have been trying to figure out why I couldn't properly communicate over serial to a hardware device over serial with my Arduino. Basically, I am connecting my hardware device to the Arduino using an Audio Jack.

The hardware device is running on 3.3v and the Arduino at 5v, which is probably the issue. But

Here the current Wiring:

[

Audio Cable:

Rx = Green Wire
Tx = White Wire
GND = Blue Wire

I would really appreciate if someone helps me out with the following questions:

Is ground connected to where it's supposed to be?
Is the voltage a problem? If so, what kind of converter should I add?

Regards.


texts: Adapt Dynamixel library to different shields

texts:
I have been playing around with this shield for a couple of days now and I have to agree with some statements made in the comments that the "library" lacks many functions.

However I have discovered the following library which was built for the Dynamixel shield: https://github.com/zcshiner/Dynamixel_Serial

I wanted to know since I am using an Arduino Uno, which parameters I would have to change to make it work.

Sorry I am not very fluent in C++. I have tried just changing the direction pin to 10 but it's obviously not sufficient.

Shield to be dealt with: https://dfrobot.com/index.php?route=product/product&product_id=958

The following code should work afterwards:

#include <dynamixel_serial.h> // Library needed to control Dynamixel servo

#define SERVO_ID 0x01 // ID which we will set Dynamixel to
#define SERVO_ControlPin 0x0A // Control pin of buffer chip, NOTE: this does not matter because we are not using a half to full control buffer.
#define SERVO_SET_Baudrate 57600 // Baud rate speed which the Dynamixel will be set to (57600)
#define CW_LIMIT_ANGLE 0x001 // lowest clockwise angle is 1, as when set to 0 it sets servo to wheel mode
#define CCW_LIMIT_ANGLE 0xFFF // Highest anti-clockwise angle is 0XFFF, as when set to 0 it sets servo to wheel mode

void setup() {
  delay(1000); // Give time for Dynamixel to start on power-up
  Dynamixel.begin(SERVO_SET_Baudrate); // We now need to set Arduino to the new baud rate speed
  Dynamixel.setDirectionPin(SERVO_ControlPin); // Optional. Set direction control pin
  Dynamixel.setMode(SERVO_ID, SERVO, CW_LIMIT_ANGLE, CCW_LIMIT_ANGLE); // set mode to SERVO and set angle limits
  Serial.begin(115200);
  Serial.println("Setup Done!");
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  Dynamixel.servo(SERVO_ID,0x001,0x100); // Move servo to angle 1(0.088 degree) at speed 100
  delay(4000);
  Dynamixel.servo(SERVO_ID,0xFFF,0x3FF); // Move servo to max angle at max speed (1023)
  delay(4000);
}


texts: GSM Modem with MAX232 to Arduino Serial?

texts:
I have GSM modem that has MAX232 interface for RX/TX/GND on three pins.
Is it possible to interface Arduino in some way?

Tnx for help.


texts:
I just bought 4 8x8 led matrix module from online store...when I connect the led module to arduino and computer without any program, the led shows weird pattern (isn't that is should show all 64 led lighted up???) attached with the photo

It still weird pattern after I programmed it


texts:
I have a teensy that controls a motor and reads from a ir sensor, GP2Y0E02b. The issue i run into is that at random times the teensy seems to freeze, the main code stops printing but the interrupt routine continue to work. It seems to be that when reading the ir sensor it causes the teensy to freeze. The code below is what I'm using to read the ir values.

#include <i2c_t3.h>
//#include <WSWire.h>
#include <Arduino.h>
uint16_t ReadFirstSensor();
uint16_t ReadSecondSensor();

#define ADDRESS       0x80 >> 1  // Arduino uses 7 bit addressing so we shift
address right one bit
#define DISTANCE_REG  0x5E
#define SHIFT         0x35

class GP2Y0E02B {
public:
    int MaxDistance;
   int MinDistance = 27;
float distance = 0;
byte high, low = 0;
float shift = 0;
bool badSensor = false;

GP2Y0E02B(){
  //Serial.println("Sensors Initialized");
};

float GetRawDistance()
{
    //if (!badSensor){
      float FirstDistance = ReadFirstSensor();
      return FirstDistance;
    //}
    //else
    //  return 22000;
}

void StartSensors()
{
    //Serial.println("StartSensors Called");
    Wire.begin(400000);
    delay(50);
    //Serial.println("Wire.begin() has been called");
    Wire.beginTransmission(ADDRESS);
    //Serial.println ("beginTrans done");
    Wire.write(SHIFT);
    //Serial.println ("Shiftwrite done");
    int stat = Wire.endTransmission();
    //Serial.print("endTrans done stat: ");Serial.println(stat);

    int i = 0;
    while (Wire.available() == 0)
    {
        //Serial.println ("Im trying SPI");
        i++;
        delay(5);
        if (i>30) break;
    }
    if (i<30)
    {
        shift = Wire.read();
        Wire.requestFrom(ADDRESS, 1);
        MaxDistance = GetRawDistance();
        badSensor = false;
    }
    else
    {
        //Serial.println ("couldnt initialize the sensors");
        badSensor = true;
    }
 }

 uint16_t ReadFirstSensor()
 {
    static int LastDist = 0;
    //Serial.println ("Read First sensor called");
    Wire.beginTransmission(ADDRESS);
    Wire.write(DISTANCE_REG);
    //Serial.println ("DoneWireWrite");
    int SPIhealth = Wire.endTransmission();
    //Serial.print ("DoneWireEndTransmit: ");Serial.println (SPIhealth);
    if (SPIhealth == 0) Wire.requestFrom(ADDRESS, 2);
    else return LastDist;
    //Serial.println ("DoneWireREquest");

    int EmergBreak = 0;
    while(Wire.available() < 2)
    {
        //Serial.println ("Trying to get sensor reading");
        EmergBreak++;
        delay(1);
        if (EmergBreak > 20) return LastDist;
    }
    if (EmergBreak > 20);//Serial.println ("Couldnt Read Sensor");
    //else Serial.println ("Done Reading Sensor");

    high = Wire.read();
    low = Wire.read();

    uint16_t rawDistance;
    rawDistance = (high * 16 + low)/16/(float)pow(2,shift); // Calculate the range in CM
    //Serial.print("rawDistance: ");Serial.println(rawDistance);
    rawDistance = (uint16_t) low ;
    rawDistance += (uint16_t)high << 8;
    LastDist = rawDistance;

    return rawDistance;
  }

};


texts:
I am at the moment trying to make a bipolar stepper motor move.
I am interfacing it through a control board, which takes the input Step, Dir, En, and 5V.

I am providing those input signal via an Arduino, but can't get the damn thing to move. all it does it move a step forward and backwards, like it being stuck or and tries to wiggle out of something.. What could the reason be..

Here is the Code:

#include "stepper_motor.h"
int max_step = 200;
stepper_motor::stepper_motor()
{
  pinMode(BUILTIN_LED,OUTPUT);
  pinMode(step_pin,OUTPUT);
  pinMode(dir_pin,OUTPUT);
  pinMode(en_pin,OUTPUT);

  alive_bool = true;
  position_bool = false;
  step_count = 0;
}

void stepper_motor::step_pwm()
{

  if(position_bool==true)
  {
    //Dir pin low
    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,LOW);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    int step = 0;
    while(step < max_step)
    {
      digitalWrite(step_pin,HIGH);
      delay(1);
      digitalWrite(step_pin,LOW);
      delay(1);
    }

    //digitalWrite(en_pin,LOW);
    //position_bool = false;
  }
  else
  {
    //Dir pin high
    delay(1000);
    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,LOW);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,HIGH);

    int step = 0;
    while(step < max_step)
    {
      digitalWrite(step_pin,HIGH);
      delay(1);
      digitalWrite(step_pin,LOW);
      delay(1);
    }

    //digitalWrite(en_pin,LOW);
    //position_bool = true;
  }

}

Updated step_pwm():

void stepper_motor::step_pwm()
{
    //Start -  En Low , DIR HIGH, STEP high
    //init configuration!
    digitalWrite(step_pin, HIGH);
    digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,LOW); // Previous LOW

    delay(0.005);

    //T1-  En HIGH , DIR HIGH, STEP HIGH
    //Enable high
    //digitalWrite(step_pin, HIGH);
    //digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    //T2-  En HIGH , DIR low, STEP HIGH
    //Direction choosen
    //digitalWrite(step_pin, HIGH);
    digitalWrite(dir_pin,LOW);
    //digitalWrite(en_pin,HIGH);

    delay(0.005);
    //T2-  En HIGH , DIR low, STEP HIGH
    //STEP  step between low and high with 2.5µs between

    while(1)
    {
      digitalWrite(step_pin,LOW);
      delay(2.5);
      digitalWrite(step_pin,HIGH);
      delay(2.5);
    }

}

The control board i am using is a ST330-v3
The motor i am using is this one
here is a little block diagram of how things are connected.


texts: Issues controlling servo motors with serial monitor while using 16 channel servo Shield

texts:
I am making a 6-axis robotic arm that uses multiple servo motors.The goal is to create a program that accepts degree values from the serial monitor to control multiple servo motors.

I have just started programming with the Arduino, so I need help debugging a program that I have piece together from guides throughout the internet. The program will compile and upload, but when I input values into the serial monitor the servo will not move like I would like it to. At the moment, the servo motor will move 50 degrees. I have calibrated my servo but it still won't work properly. Furthermore, I kept the program for one servo just for testing I know that I will have to create an int motorA=0; motorB=1; etc. Any help will be appreciated

reference links:
https://forum.arduino.cc/index.php?topic=242458.0
https://www.youtube.com/watch?v=y8X9X10Tn1k

Hardware:
Arduino Uno
16 channel Arduino Servo shield
5v external power supply
MG995 Servo

Notes:
No connectivity issues
Motor is connected properly
No hardware issues

Program:

enter code here
String readString;
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

#define SERVOMIN  650
#define SERVOMAX  2350
#define FREQUENCY 60

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

int motorA = 0;
int motorB = 1;

void setup()
{ // put your setup code here, to run once:
  Serial.begin(9600);
  pwm.begin();
  pwm.setPWMFreq(FREQUENCY);
}

void moveMotor(int ang, int motorOut)
{

 int angle = map(ang,0, 180, SERVOMIN,SERVOMAX);
 for ( uint16_t pulse_width = 0; pulse_width < angle; pulse_width++)
 {
   pwm.setPWM(motorOut, 0, pulse_width);

 }
}

void loop()
{
 //expect single strings like 30c, or 90a, or 180d,
//or combined like 30c,180b,70a,120d,

if (Serial.available())
{
  char c = Serial.read();  //gets one byte from serial buffer
  if (c == ',')
  {
    if (readString.length() >1)
    {
     Serial.println(readString); //prints string to serial port out

     int angle = readString.toInt();  //convert readString into a number

     Serial.print("writing Angle: ");
     Serial.println(angle);
     if (readString.indexOf('a') >0) moveMotor(angle, motorA);

     readString=""; //clears variable for new input
   }
 }
else {
  readString += c; //makes the string readString
  }
 }
}


texts:
I have recently decided to buy an arduino over a raspberri pi and have been shopping for a good deal and learning about which model I need and where to buy.

I have come across a few very cheap arduino uno boards that are identical to every other board. These range from an unbelievable $4-$15. Are they officially branded and/or are they trustworthy?

Here is a link to a few links to some I've found:

http://m.ebay.com/itm/New-UNO-R3-ATmega328P-Development-Board-For-Arduino-Compatible-USB-Cable-DIY-/311418263595?nav=SEARCH

http://m.ebay.com/itm/NEW-UNO-R3-ATmega328P-CH340-Mini-USB-Board-for-Compatible-Arduino-WL-/161883302204?nav=SEARCH


texts:
I'm going to write a sketch that would light up the first LED (D1) of the training shield at the beginning, then move the LED light to the left or to the right whenever you press the S1 or S2 buttons, respectively. When the LED is already at the first (D1) or the last (D8), it should no longer move when going further to the left or right, respectively.

Looks exactly like this: https://www.youtube.com/watch?v=_KQQTdDMgOU

Here's what I made so far:

int x = 0;

void setup() {
  for(int i=11; i <= 18; i++) {
    pinMode(i, OUTPUT);
  }
}

void loop() {
  x = digitalRead(pushButtonPin);
  if (pushButtonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}


texts: error: too few arguments to function 'char* itoa(int, char*, int)' byte blockcontent= itoa(order); ^ In file include

texts:
I have this statement in my Arduino code :

 byte blockcontent [16] = itoa(order);

and it gives me an error saying:
"Too few arguments to function 'charitoa(int,char,int)'. Even though I've looked for the documentation of itoa function and I found that it accepts one input argument.
Can anyone help me fix this error?


texts:
I have the code to pass the data from dht22 to sd but for only one and i want to pass the data from 1 dht22 with one file and the data from other sensor to other file and logging in to sd. Anyone can help me?

#include
#include
#include "DHT.h"
#define DHTPIN 8
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
File data_file;

int CS_pin = 10;
long sec=00;
long mint=00;
long hr=00;

void setup() {
Serial.begin(9600);
pinMode(CS_pin, OUTPUT);
dht.begin(); //This command will start to receive the values from dht22
// SD Card Initialization
if (SD.begin())
{
Serial.println("SD card is initialized and it is ready to use");
} else
{
Serial.println("SD card is not initialized");
return;
}
}

void loop() {
data_file = SD.open("data.txt", FILE_WRITE);
if (data_file) {
getData();
}
// if the file didn't open, print an error:
else {
Serial.println("error opening data.txt");
}
delay(1000);
}

void getData(){
for(long sec = 00; sec < 60; sec=sec+2){
float temp = dht.readTemperature(); //Reading the temperature as Celsius and storing in temp
data_file.print(hr);
data_file.print(":");
data_file.print(mint);
data_file.print(":");
data_file.print(sec);
data_file.print(", ");
data_file.println(temp);
Serial.print(hr);
Serial.print(":");
Serial.print(mint);
Serial.print(":");
Serial.print(sec);
Serial.print(", ");
Serial.println(temp);
if(sec>=58){
mint= mint + 1;
}
if (mint>59){
hr = hr + 1;
mint = 0;
}
data_file.flush(); //saving the file
delay(2000);
}
data_file.close(); //closing the file
}

Thanks


texts: Is it possible to transmit radio signal with cheap 433Mhz transmitter as strings and receive it with an RTL-SDR

texts:
I have these Arduino transmitters and receivers.

They are very common. I am just trying to transmit a "Hello" Message using this code.

#include <RH_ASK.h>
#ifdef RH_HAVE_HARDWARE_SPI
#include <SPI.h> // Not actually used but needed to compile
#endif

RH_ASK driver;
// RH_ASK driver(2000, 4, 5, 0); // ESP8266 or ESP32: do not use pin 11 or 2
// RH_ASK driver(2000, 3, 4, 0); // ATTiny, RX on D3 (pin 2 on attiny85) TX on D4 (pin 3 on attiny85),

void setup()
{
#ifdef RH_HAVE_SERIAL
    Serial.begin(9600);   // Debugging only
#endif
    if (!driver.init())
#ifdef RH_HAVE_SERIAL
         Serial.println("init failed");
#else
    ;
#endif
}

void loop()
{
    const char *msg = "hello";

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}

But they have to be received from the receiver module using another set of codes which I have done it.

But my question is, is it possible to receive the transmitted message with one of RTL-SDR's INSTEAD of using the receiver module? If so, How to do it?


texts:
I have decided to use NRF24L01+’s for my Arduino project for wireless communication. I am using the RF24 library by TMRh20 to talk back and forth.

Github Link: https://github.com/nRF24/RF24

I want to be able to send and receive data as fast as possible between the remote, and the receiver. After reading through the library I was able to create a some simple code that allowed the remote to transmit ~600 32-byte messages a second and the receiver was able to read ~490 messages a second.

Transmitter Loop Code:

if (radio.available())
  { radio.read( &myData, sizeof(myData) ); }

Receiver Loop Code:

radio.write( &myData, sizeof(myData), 1);

With this code however, the remote control cannot receive telemetry data back from the receiver. It is only a one way communication with no acknowledgments.

I have a few questions about wireless communication with the NRF24L01+. First, what is an acknowledgement? I understand it is a way for the transmitter to know that the receiver got the message, but what is being sent in the acknowledgment?

What is the difference between commands such as radio.write, radio.writefast, radio.startwrite, and radio.startwritefast. The RF24.h file has explnations of these commands but their desrciption does not make too much sense to me.

After doing some research, I found that to write, I must stop listening, write the message, and then start listening again for messages. The issue with this code is that the NRF is never listening long enough to receive a message (unless I add in a delay where it stays in RX mode). Is there anyway to keep a reading pipe open while writing and then pick it up from the FIFO when I am ready to read?

It seems that it is possible to write an ACK Payload, and this allows the NRF to transmit a message without leaving RX mode. Is this a possibility, and what is an ACK Payload?

What is the best practice for achieving the fastest speed two-way communication. Is it common practice to have two NRF’s and have one dedicated to listening and one dedicated to writing on each Arduino? Is there a good way to achieve high speed two-way communication rates with a single NRF?


texts:
I am building a flight sim button box and I would like someone to please check my proposed wiring diagram.
I will be using 12 buttons, 4 rotary encoders, each also with a push button and 4 (on)-off-(on) toggle switches as well as one additional toggle switch to use as a modifier for the buttons.

Any comments or suggestions appreciated.


texts: Measuring high frequencies (300kHz) with arduino

texts:
I'm designing a frequency generator with ICL8038, which would output sine, square and triangle waves, which would reach frequency such as 300kHz.

I've already designed a circuit around the ICL8038, but I'm unsure how to measure the frequency, to show on LCD display.

I'm leaving down a schematics I've drawn.
A.Duty is going to the analog input of arduino, which will show the duty cycle between 2% and 98%. This will be going to a voltage divider to make a proportional input for the arduino analog input.

The "frequency pin" would be connected directly from the BNC connector from the casing, which means, that the input can be triangular, sine or square.

Just to mension, in case it makes any kind of difference, I'm planning to use just Atmega328 with 16MHz quartz and 2 capacitors, not exactly as Arduino UNO or NANO.
But the Atmega will have a arduino bootloader on it.

By the time asking about ICL8038, I've got also few questions about the IC:

You connect the FM Bias(pin 7) and SWEEP (pin 8) together to create sweep on the output of any kind of signal, whichever it is? This is fixed time constant or should I add some kinda coapacitor there?
What exactly does Tcap (pin 10) does? I've read through the datasheet but couldn't understand it's meaning.
How would I get proper voltage range every time, when I would change the input voltage of the ICL8038? (it has wide range of output signal, proportionall to the input; it goes from 36V to input, 28V max output)
For power supply would be proper LM317 as adjustable power supply (since it has low power consumption) and just use a potentiometer to adjust input of the ICL8038 and monitor the OUTPUT levels?
PIn 13 and PIn 14 are NC (not connected). Can I just connect them together and connect them to GND?

As if anybody knows for any "better" IC as this one is, please let me know.
I'm already going to have to buy it from China (this gives me doubts about the capabilities), I'd rather just order one from Europe or US.


texts: Can Atmel Studio 6 Simulator simulate SPI?

texts:
I am trying to do PAL composite video output with Arduino Nano. I am using Atmel Studio 6, not the Arduino IDE. I am sending out the picture data via SPI. On the TV I could not see the text I tried to produce, so I tried to run my program in the Atmel Studio simulator (to use it as a logic analyzer). But in the resulting stimuli file I also do not see the MOSI pin changing.

I am using the A0 pin (PORTC bit 0) to send out the sync signal, that appears correctly in the output .stim file: PORTC changes exactly at the right time. But PORTB does not change at all.

My program can definitely be buggy, but that is another topic... the question is, can Atmel Studio Simulator simulate the SPI at all?


texts: Unsure how to get pressure data from MCP3424

texts:
I am having trouble reading data from an MCP3424 chip, specifically the one from this website:

https://uk.rs-online.com/web/p/general-purpose-adcs/6696086/

I have a pressure transducer that connects to the MCP3424 chip. The chip is then connected to a NodeMCU 1.0. Schematics are attached.

The pressure transducer comes from here:

https://www.edwards.com/gb/devices/pressure-monitoring/transducer?WT.ac=eu_truwave

It is run into a 9-pin VGA adapter

I am new to this kind of stuff, and I do not know what code is needed on the NodeMCU to read the data coming in from the pressure transducer via the MCP3424 chip. My code currently contains code from here:

https://github.com/bersch/MCP3424

My code is set to upload the error message I am getting from the MCP3424 to a spreadsheet so I can read the error. The error I get is "i2c". I am not sure what that means. I have tried contacting the author of the code but I have not received a response in a few weeks. I simply want to read the pressure I am getting from the pressure transducer from the MCP3424 chip.

Some useful information about the MCP3424 chip can be found here:

http://ww1.microchip.com/downloads/en/DeviceDoc/22088b.pdf

If anyone can provide any guidance, code, or helpful advice, that would be extremely appreciated.

Link to my post on the arduino forum, which includes my code, is here:

https://forum.arduino.cc/index.php?topic=588831.0

Thank you.


texts: Problem using HC-12 graphical configuration utility, invalid responses

texts:
I'm trying to use this utility [first time] to config a pair of HC-12s to a different channel, as I already have the default address in use.  It's a very handy utility, though I can find almost no reference to it via Google.

I found reference to the command here:
http://www.thebackshed.com/forum/forum_posts.asp?TID=8246&PN=1

When I use to change the channel, i get 5 error messages of the form:
invalid response(1),
invalid response(3.2),
invalid response(3.3),
invalid response(3.4),
invalid response(3.5)

I am running on Windows 10 x6, using a standard USB cable to an Uno.
The wiring config is as follows:
VCC to 5v,
GND to GND,
RXD to pin 4,
TXD to pin 5,
Set to pin 6

I've also tried connecting the Set pin to GND, as I don't know whether this is necessary or not.

The board also has an 1N4007 diode in series with the power line, and a 1000uf capacitor twixt 5v and GND.  Nothing else.

There is a sample program at:
http://www.allaboutcircuits.com/projects/understanding-and-implementing-the-hc-12-wireless-transceiver-module/

that should accomplish the same function via use of line commands and I shall try that next.  However, the configuration utility is so handy that I would like to have it in my kit of useful tools.

Seeking:
Assistance with the graphical configuration utility by someone who knows more than I, or perhaps a better alternative.


texts: How to free up Flash space by removing the bootloader on UNO?

texts:
In order to fit maximum user program into the chip, how to free up Flash space (0.5 kilo bytes for UNO, 2 KB pro Mini, 8KB for ATMega2560) by removing the bootloader on Atmega328 (UNO, Pro Mini, or similar)?

What software development tools needed (like Atmel AVR Studio software or similar)?

What hardware flash writing / debug tools needed (like JTAG hardware programmer/debugger)?

How is the procedure? Where can I get more information.

Many thanks in advance.

edit: Update boot loader size for different boards


texts: Arduino with ATmega32U4 low power but keep Serial1 working

texts: I am looking for a low power solution for my ATmega32U4. It uses Serial1 to communicate with Bluetooth, so I need to have it active. When I receive data from Serial1, I want to power up the Arduino, do some magic, and then power it off...


texts: How do I connect a LED strip to a Multiwii SE 2.5?

texts:
https://www.m.nu/neopixel/mini-skinny-neopixel-digital-rgb-led-strip-60-led-m-black-pcb-1m

I just purchased this led-strip that I plan to use with my Multiwii SE 2.5.

I power the Multiwii itself via a power distribution board where I connect a 3s LiPo battery. Now I wonder how I would wire my LED strip in order to use it with my Multiwii. I have a few smaller LiPo batteries if I need to power the LED itself (not via the 3s LiPo that powers the Multiwii) but the best solution would of course be to power them together.

I appreciate all help I can get.


texts: How do I get a nonzero output from my HX711 and load cell?

texts:
I am trying to set up a load cell using the HX711 amplifier. Whenever I upload my sketch, my serial monitor only will read zeros regardless of load applied to the sensor (no signal appears to be sending from my load cell).

Here is my wiring, with the Arduino Uno connected to a COM port. I am using an Arduino Uno, HX711, and Sparkfun's TAL220 Straight Bar 10kg load cell.

Here is the calibration sketch I am using (from the HX711 hookup guide):

#include <HX711.h>

#define DOUT 9
#define CLK 8

HX711 scale(DOUT, CLK);

float calibration_factor = 282650; //-7050 worked for my 440lb max scale setup

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press + or a to increase calibration factor");
  Serial.println("Press - or z to decrease calibration factor");

  scale.set_scale();
  scale.tare(); //Reset the scale to 0

  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);
}

void loop() {

  scale.set_scale(calibration_factor); //Adjust to this calibration factor

  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1);
  Serial.print(" kgs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 10;
  }
}

And here is a typical output from the serial monitor (I previously had this load cell functioning correctly, which is why my calibration factor is so different).

Observations:

Whenever I upload the sketch and open the serial monitor, the TX LED on my Arduino Uno will light up flashing, but the RX LED stays off.
Removing the scale.tare() step will output a constant nonzero value, but the load cell is unaffected by any loading:

I have tried adding an external power supply to the hookup assembly (I don't know if this is even necessary, but I know the load cell requires excitation to function, so I thought I'd give it a try). So far it has not changed the output in any way.
I have also tried adjusting the calibration factor, which only offsets the constant value outputted.
I have re-soldered the connecting wires to the load cell and replaced the remaining wires, as well as tried multiple Uno Boards and a new USB cord. I have also gone over my wiring and had my labmate check it too (though I will definitely not rule out it being some small wiring/hardware mistake on my part, as I am still very new to Arduino).

Thank you for any suggestions!


texts: Post-split, where do I download the Arduino IDE?

texts:
I've been out of the loop with Arduino for several years.  I heard about the split (another link), but didn't really understand, nor keep up with it, nor the details of the fallout.

Today, I decided to jump back in and make something, and a DDG search led me to Arduino.cc to get the software.  But is that what I need?

How do I know if that's the right software IDE?  Is there another location?  Does it matter?  Does it depend on more variables?  Is this split akin to the OpenOffice and LibreOffice split, where one is more better (technical term!) supported than the other?

I'm working on an Arduino Uno I got from Microcenter.


texts:
I'm sending some data by 433Mhz transmitter using manchester.h library from here https://github.com/mchr3k/arduino-libs-manchester and I'm trying to wrap my head around message format. In manchester.cpp it is described very poorly.

I'm sending number 1. Here is the code for that:

#include <Manchester.h>
/*
  Manchester Transmitter example
  Try different speeds using these constants, your maximum
  possible speed will depend on various factors like transmitter
  type, distance, microcontroller speed, ...
  MAN_300 0
  MAN_600 1
  MAN_1200 2
  MAN_2400 3
  MAN_4800 4
  MAN_9600 5
  MAN_19200 6
  MAN_38400 7
*/
  #define TX_PIN 4  //pin where your transmitter is connected

  uint8_t transmit_data = 1;
  void setup() {
  man.setupTransmit(TX_PIN, MAN_4800);
}
  void loop() {
  man.transmit(transmit_data);
  delay(200);
}

Here is the screenshot from oscilloscope:

And here is the message for sending 0:

In manchester.cpp you can find message format:

/*
    format of the message including checksum and ID

    [0][1][2][3][4][5][6][7][8][9][a][b][c][d][e][f]
    [    ID    ][ checksum ][         data         ]
                  checksum = ID xor data[7:4] xor data[3:0] xor 0b0011

*/

But when you look at the actual oscilloscope readings it does not fit at all! Maybe I'm missing something? I'll be very grateful for any help in understanding this topic:)


texts: Converting uint8_t to String - unexpected result

texts:
I'm working on a remote control code for ESP controller. Using ESPwebserver and Fastled. When I try to return a value of an uint8_t, as a POST response, i got strange result here is the relevant code:

uint8_t PaletteBrightness = 255;

server.on("/Sync", HTTP_POST, []() {
String Sync = "PaletteBrightness:" + PaletteBrightness;
    Sync += ":end";
    Serial.println(Sync);
    server.send(200, "text/plain", Sync);
  });

The code complies, and runs fine but the result of 'Sync' in both serial, and POST response is:

Phase:end

Why? What does even Phase mean?
What I want is:

PaletteBrightness:255:end

Where the 255 is the value of 'uint8_t PaletteBrightness' Also, there will be more values, to add the 'Sync' string. Just trying to get one right.


texts:
found this
http://www.zevendevelopment.com/relayexpander.html
I was looking to control 48 relays in sequential order with external controls for duration and frequency. How do I properly communicate to the boards? Sorry new to this setup.


texts:
I found this wonderful breakout board based on FT232. I wonder if I can use this board for connecting my arduino to a USB dongle for 3g/GPRS connection ?

From what I understand this board can be connected to the serial data pins of the arduino board. And if I connect the USB dongle to the FT232 board, I should be able to run AT commands from the arduino board.


texts: What's the pinout of the Gravity MOSFET power controller board?

texts: I found https://wiki.dfrobot.com/Gravity__MOSFET_Power_Controller_SKU__DFR0457 this board for a non-Arduino project and it does not list the pinout of the JST-PH 2.0 header but it does show it connected to an Arduino so I was hoping people familiar with the Arduino could figure out based on that.


texts: Sending servo position data from one Arduino to another

texts:
I'm trying to take the position data generated from this servo sweep, and send over serial to another Arduino. The position data is stored as pos in the code I included, what would be the best method for doing this?

/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}


texts: Arduino classes, can't get property value

texts:
I have tried hard to make a stepper motor work with a class, but I can't get a property returning its value in a method. I get 0 (zero) instead of 26 (expected) from _stepPin.

I have tried this->_stepPin with no success.

Here is the code. See the comments inside.

 class MKSStepperMotors {

   public:
    int _dirPin;
    int _stepPin;
    int _enablePin;

    MKSStepperMotors(int dirPin, int stepPin, int enablePin) {

      int _dirPin = dirPin;
      int _stepPin = stepPin;
      int _enablePin = enablePin;

      //Habilitamos el motor
      pinMode(_enablePin, OUTPUT);
      digitalWrite(_enablePin, LOW);

      //Cambiamos la direccion y aumentamos la velocidad
      pinMode(_dirPin, OUTPUT);
      digitalWrite(_dirPin, LOW);

      // Le indicamos el pin de señal
      pinMode(_stepPin, OUTPUT);

    }

    void move(int steps, int stepDelay)
    {

      for (int x = 0; x < steps; x++) {
        Serial.println(_stepPin); //  <-- _stepPin is zero and not 26 as it should
        digitalWrite(_stepPin, HIGH); <-- _stepPin is zero and not 26 as it should
        delayMicroseconds(stepDelay);
        digitalWrite(_stepPin, LOW);  <-- _stepPin is zero and not 26 as it should
        delayMicroseconds(stepDelay);
      }
    }
};

 MKSStepperMotors pedo(28, 26, 24);

 void setup() {
  Serial.begin(250000);
}

 void loop() {

      pedo.move(3200,100);

}


texts: Multiple slave(sender) to one master (receiver)

texts:
I beg your help to my project
I wish to send the data from slave to master but only one data is receive out of two slaves.

//master

#include <Wire.h>

void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output

}

void loop() {
  Wire.requestFrom(8, 1);    // request 6 bytes from slave device #8

  while (Wire.available()) { // slave may send less than requested
    char c= Wire.read(); // receive a byte as character
    char q= Wire.read();

  Serial.print(c);         // print the character
  Serial.print(q);
  }

  delay(1500);
}

////slave 1

#include <Wire.h>

void setup() {
  Serial.begin(9600); // Starting Serial Terminal
  Wire.begin(8);                // join i2c bus with address #8
}

void loop(){
  Wire.onRequest(requestEvent); // register event

  delay(1500);
}
void requestEvent() {

  Wire.write('Q');
  Serial.println("Sent");
}

////slave 2

#include <Wire.h>

void setup() {
  Serial.begin(9600); // Starting Serial Terminal
  Wire.begin(8);                // join i2c bus with address #8
}

void loop() {
  Wire.onRequest(requestEvent); // register event

  delay(1500);
}
void requestEvent() {

  Wire.write('Y');
  Serial.println("Sent");
}


texts:
I am struggling programming my DS2436 chip using Arduino UNO. To be honest I am trying to modify DS18B20 code (the one that is anywhere on the internet) to work with DS2436. It's just harder for me to understand how whole memory and adressing thing work, since DS2436 has those pages of memory blocks, unlike DS18B20 who has only 1. Also the language factor is stopping me, I am not a native speaker.
I keep getting wrong data\temperature\crc code.
Can someone assist me, please? I need this thing to show me voltage\temperature and cycles.

#include <OneWire.h>
OneWire  ds(10);

void setup(void)
{
  Serial.begin(9600);
}

void loop(void)
{

  byte i;
  byte addr[8];
  byte data[32];
  byte type_s;
  byte present = 0;
  float celsius, fahrenheit;

  if (!ds.search(addr))
  {
    ds.reset_search();
    delay(1000);
    return;
  }

  Serial.print("ROM =");
  for( i = 0; i < 8; i++)
  {
    Serial.write(' ');
    Serial.print(addr[i], HEX);
  }
  Serial.print("\n");

  if (OneWire::crc8(addr, 7) != addr[7])
  {
    Serial.println("CRC is not valid!");
    return;
    Serial.print("\n");
  }

  if (addr[0] != 0x1B)
  {
    Serial.print("Device is not a DS2436 family device!");
    Serial.print("\n");
  }

  {
    Serial.print("CRC= ");
    Serial.print(OneWire::crc8(data, 8), HEX);
  }
  Serial.print("\n");

  ds.reset();
  ds.select(addr);
  ds.write(0xD2, 1);
  delay(1000);

  present = ds.reset();
  ds.select(addr);
  ds.write(0xB2);

  Serial.print("  Data = ");
  for (int i = 0; i < 13; i++) {
    data[i] = ds.read();
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
  Serial.print(" CRC=");
  Serial.print(OneWire::crc8(data, 8), HEX);
  Serial.println();

  unsigned int raw = (data[1] << 8) | data[0];

  int sig = raw & 0x8000;
  if (sig)
  {
    raw = (raw ^ 0xffff) + 1;
  }
  celsius = (float)raw * 0.03125;

  Serial.print("Temperature = ");
  Serial.print(celsius);
  Serial.print(" Celsius ");
  Serial.print("\n");
  Serial.print("_______________________________________________");
  Serial.print("\n");
}


texts: How can I power an Arduino Nano with a LiPo battery, preferably 3.7v

texts:
I am a newbie to Arduino, so please bear with me. I am trying to figure out how to power an Arduino Nano with a LiPo battery. I want to use a 3.7v if possible, as my project needs to be lightweight. There are two possibilities I know could work:

-Taking a USB to Mini-B USB, cutting off the normal USB end, and soldering a connector (based on the battery I use) to that end. I would then plug the Mini-B USB into the Nano, giving it power.

-Using the 5v and Ground pins.

I would prefer to use the USB cable solution, however the 5v/Ground or any other solution is perfectly usable.

Also, would 3.7v be enough to power the Nano, two Infrared LEDS (Launch and Receiver), and a 7-segment LED display. I also have a button.
                                                             Thanks, saddlepiggy!


texts:
I found this question:
Set PWM frequency to 25 kHz

It is useful, however, I want to use it to generate ~14KHz?

int d = 0;            // pwm value

void setup()
{
  //  Sets Timer1 to Phase Correct
  //  F_CLOCK / ( Prescaler * ORCR1A * 2 ) = Freq in Hz
  //  16000000 / (1 * 512 * 2 ) = 15625 Hz
  TCCR1A = _BV (WGM10) | _BV (WGM11) | _BV (COM1B1);  // Phase Correct
  TCCR1B = _BV (WGM13) | _BV (CS10);                  // Phase Correct / Prescale 1
  OCR1A = 571;                                        // Sets Top to 512 --571
  OCR1B = 0; // Sets Pwm =
    pinMode(10, OUTPUT);
    pinMode(0, INPUT)
}

void loop()
{
  d = (analogRead(0));
  d = map(d, 0, 1023, 0, 512);
  OCR1B = d;
}

I used this sketch to test the frequency which works good. If I change the pinMode(10, OUTPUT);, into: pinMode(9, OUTPUT); and there is no output, why?


texts: How to exit out of a timer interrupt (ISR(TIMER1_COMPA_vect))

texts:
I have a code here where I collect an array of data and do some data analysis with the data. The only thing I'm struggle with is how to exit the ISR after I am done running my code. I am using a pre-scalar of 256 and running the ISR once (1Hz)
const signed int numReadings = 21;
volatile int gauge0[numReadings];
volatile int gauge1[numReadings];
volatile int add[numReadings];
volatile int deltaGAUGE;
volatile int slopeADD;
volatile int mean;

const int A0_pin = PC0;
const int A1_pin = PC1;

const uint16_t t1_load = 0;
const uint16_t t1_comp = 62500;

void setup() {

  //Set A0 and A1 pins as inputs
  DDRC &= ~(1 << A0_pin);
  DDRC &= ~(1 << A1_pin);

  //Reset Timer1 Control Reg A
  TCCR1A = 0;

  //Set CTC mode
  TCCR1B &= ~(1 << WGM13);
  TCCR1B |= (1 << WGM12);

  //Set to prescaler of 1024
  TCCR1B |= (1 << CS12);
  TCCR1B &= ~(1 << CS11);
  TCCR1B &= ~(1 << CS10);

  //Reset Timer1 and set compare value
  TCNT1 = t1_load;
  OCR1A = t1_comp;

  //Enable Timer1 compare interrupt
  TIMSK1 = (1 << OCIE1A);

  //Enable global interrupt
  sei();

       Serial.begin(9600);
       Serial.println(" ");
       Serial.println("START");
        Serial.println(" ");

}

ISR(TIMER1_COMPA_vect){

       Serial.println(" ");
        for (unsigned int i=0; i<numReadings; i++)
            {
                        gauge0[i] = (analogRead(A0_pin))*(100.00/1024.0);
                        gauge1[i] = (analogRead(A1_pin))*(100.00/1024.0);
                        add[i] = ((gauge0[i]+gauge1[i]));

                        deltaGAUGE = abs(add[20] - add[0]);
                        slopeADD = abs((add[20]-add[0])/(20-0));
                        mean = (add[1]+add[2]+add[3]+add[4]+add[5]+add[6]+add[7]+add[8]+add[9]+add[10]+

                     add[11]+add[12]+add[13]+add[14]+add[15]+add[16]+add[17]+add[18]+add[19]+add[20])/20;

                        if(i == 20)
                {
                      Serial.print("This of the delta AVG reading: ");
                      Serial.println(deltaGAUGE);
                      Serial.println(" ");
                      Serial.print("This of the slope reading: ");
                      Serial.println(slopeADD);
                      Serial.println(" ");
                      Serial.print("This of the mean reading: ");
                      Serial.println(mean);
                      Serial.println(" ");
                      Serial.println("END");
              }

                        delay(50); //wait .05 sec

          }

}

void loop()
{

}

When I run the circuit, the interrupt keep executing every seconds for an infinite amount of time, while I just want it to run once and exit.
I have tried the exit(0) command but I get an output that looks like this
START

This of the delta AVG reading: 0

This of t

As you can see, The program does not execute completely. Anyone have any idea how I can fix this, or anyhow I can better my code? thank you.


texts: What does the datasheet information for a switch mean?

texts:
I'm clueless when it comes to the information on datasheets for switches. When I see a datasheet for LEDs or servos, I'm used to seeing a fairly straightforward call out for the required volts and amps.

A project I'm working on now requires turning on an LED using a float switch like this one:
Water Level Switch

The max switching voltage and current values, and minimum voltage info is really throwing me. The minimum voltage, for instance, is 250v DC! Does a $5 switch really require 250 volts? I haven't been able to find many schematics where they are just using a switch like this without a pump or other hardware, but I seem to remember seeing someone run a switch like this with 5v pin. And I'm totally unsure what the current would be/if I need a resistor, etc.


texts: How to send data from a smartphone to Arduino

texts:
My goal is to build an extremely low cost quadcopter, by using the sensors of my smartphone (it will be mounted on the quadcopter). The arduino will only control the speed of each motor, as received from the smartphone. What methods exist to transfer data from a smartphone to arduino?

My first idea was to simply use USB, but it turns out that my smartphone doesn't support the USB host mode. Is it possible to send data over USB without USB host mode? What alternatives do I have? I thought of using the audio port: Can I directly connect an audio channel to analog in?


texts: Is it possible to connect many arduino uno in one pc?

texts: We have many Arduinos and we will be putting each of them in a cubicle. All of them are connected to only one PC. The PC will stand as a server were you can control your Arduino there.


texts:
I'm newbie in arduino due. I need to reduce the default PWM frequency of arduino Due. Anyone have any tutorial to do this? (Frequencys like 25hz, 50Hz for example)

I read in some posts, if i change the PWM frequency, i make changes in internal timers of arduino and i loss functions like delay(), millis(), etc.

Exits any form to not lose these functions?

Thanks a lot!


texts:
C:\Users\MGMCETIT\Desktop\Dumpster\Dumpster.ino: In function 'void loop()':

C:\Users\MGMCETIT\Desktop\Dumpster\Dumpster.ino:40:28: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 if(esp8266.find("+IPD,"))

                        ^


texts: Wake up from a pin, Sleep when work is done

texts:
I have a project which needs to sleep most of the time, and when a button gets pressed, it does its thing which is producing a fading sound wave (using interrupts) until it's time to sleep again.
The goal is to reduce work load on the battery so the item can last as long as possible.
#include <avr/sleep.h>
void setup(){
  /*givePin! This is the pin that will spark the waking up!*/
  pinMode(givePin,INPUT);
  noInterrupts();
  set_sleep_mode(SLEEP_MODE_IDLE);
  /*changes to timers registers*/
  interrupts();
}
void loop(){
  ampCurrentlyOn = digitalRead(givePin);
  ampPulse =  (ampCurrentlyOn && !ampPreviouslyOn) * 255     //Reset
           + !(ampCurrentlyOn && !ampPreviouslyOn) * ampPulse//Same
           -   bool(ampPulse);  //Decay
  ampPreviouslyOn = ampCurrentlyOn;

  if(!ampPulse){//Once that value reaches 0 time to GOTO bed;
    /*This! Is this what I need to do?*/
    cli();
    sleep_mode();
    sei();
  }
}

Am I doing in the right direction? Could any pin work? How do I get the chip to understand a pin set to digital HIGH to wake up from nap time?
Thank you!


texts:
I'm trying to build a circuit that buzzes until a button is pressed, or it buzzes 5 times:

void alarm()
{
  int AlarmState = 0; //Just to get while loop going
  int count = 1;
  while(AlarmState==0)
  {
    int count = 1;
    AlarmState = digitalRead(alarmStop);
    digitalWrite(buzz,HIGH);
    AlarmState = digitalRead(alarmStop);
    delay(500);
    AlarmState = digitalRead(alarmStop);
    digitalWrite(buzz,LOW);
    AlarmState = digitalRead(alarmStop);
    delay(500);
    count++;
    if(count>=5){
       break;
    }
  }

I put a bunch of digitalRead's  so it has a better chance of catching the button press while the loop is going, there's a better way to do that I'm sure but it's not my main concern right now.

This is part of a larger project, but I hope I've posted only the necessary code. The function runs, but does not break after count equals 5. Why?


texts: How to trigger an alarm when toilet paper is low?

texts:
Anyone with kids knows they never help with the toilet paper. Anyone know how to track when it's low or out and sound an audible alarm? I just don't know what sensor to use that may help.

Some that came to mind are: by weight, by reflection (the color of the paper) or some laser tripwire - all right on the spool. I don't mind building it, it's just I don't know which sensor. Anyone know which to use?


texts: I can't upload my program because of this error

texts:
This is the error I copied  :

**Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"
Sketch uses 2304 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 192 bytes (9%) of dynamic memory, leaving 1856 bytes for local variables. Maximum is 2048 bytes.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x7b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x7b
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.**

Someone please help me because of this I am not able to upload my programs.


texts: Possible to create IP-to-USB HID (keyboard) device using Arduino?

texts:
Is it possible to create an IP-to-USB HID (keyboard) using Arduino?

I'd like to connect an Arduino to my network using Ethernet, and then send it commands using TCP/IP and have those commands translated to USB HID and sent as keystrokes to the connected PC.

I've found a few articles discussing USB HID emulation using the Arduino Uno (see http://mitchtech.net/arduino-usb-hid-keyboard) but it refers to using GPIO pins as buttons.

Am I correct that this might work if I use an Arduino Uno and then purchase an Arduino Shield Ethernet?  (seems a bit expensive, but is this the cheapest option?)

Thanks in advance!


texts: Can I cause breaking the main loop from an interrupt?

texts:
Consider this simple approach to make a light work in 3 different modes: on, off and blink:

attachInterrupt(buttonVector, switchMode, FALLING);

void loop() {
  switch(mode) {
    case 0: turnOff(); break;
    case 1: turnOn(); break;
    case 2: blinkOnce(); break;
  }
}

now if switchMode is something like this:

unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = 0;
void switchMode()
{
  interrupt_time = millis();
  // debounce measures
  if (interrupt_time - last_interrupt_time > 200)
  {
    mode = (mode + 1) % 3;
  }
  last_interrupt_time = interrupt_time;
}

then once the button is pressed, the mode is changed and if we were in the blink mode (mode == 2) we'll wait until the blink is done (let's say that's 2 seconds) and only then the mode is actually switched to the "off" mode. Now, can I stop whatever was in the process of current loop, break it and get the "off" instantly?

PS Of'course there can be some workarounds, like

void switchMode()
{
  interrupt_time = millis();
  // debounce measures
  if (interrupt_time - last_interrupt_time > 200)
  {
    mode = (mode + 1) % 3;
    if(mode == 0)
      turnOff();
    if(mode == 1)
      turnOn();
  }
  last_interrupt_time = interrupt_time;
}

but is there something more elegant and general? (note that if there's 4 modes: on, off, blink, blink_slowly, than this won't work)


texts:
The instructions to put the Arduino into DFU say I should shortcut briefly the 2 leftmost ICSP headers next to the USB port.

But my board does not have them. Does anybody know what are the right headers or if it is at all possible to set my board into DFU mode?


texts: delay() problem for 74HC595 and 7-segment

texts:
I'm trying to run a 3-digit 7-segment using single 74HC595 based on Arduino. But I have a serious problem with delay() function. When I want to count from 000 to 999 with delay(1000), this delay function causes all digits to be off! My code is as below and I uploaded a video Click Here to understand my purpose. This problem can affect some applications like reading the temperature of DS12b20 which requires a delay itself.
//                 2        1         0
//               ----      ----      ----
//              |    |    |    |    |    |
//               ----      ----      ----
//              |    |    |    |    |    |
//               ----      ----      ----

int latch = 8; //74HC595  pin STCP
int clock = 9; //74HC595  pin SHCP
int data = 10; //74HC595  pin DS

// Each annode pin (for those that don't know think of it as an on switch when it's assigned HIGH)
int dig1 = 2; // digit0
int dig2 = 3; // digit1
int dig3 = 4; // digit2
int digit[4]={dig1, dig2, dig3};

int timer=3;
// these are bits to make the 8 bit byte accepted by the segment display the 9th is the demical point
// 0-9 then invald numbers
byte table[] = {
  B00111111, B00000110, B01011011, B01001111, B01100110,
  B01101101, B01111101, B00000111, B01111111, B01101111, B01111111
};

void setup(){
  pinMode(latch, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(data, OUTPUT);
  pinMode(dig1, OUTPUT);
  pinMode(dig2, OUTPUT);
  pinMode(dig3, OUTPUT);
}

//this sends the data to the digit
void RunNum(int num, int SelectDigit){
  digitalWrite(latch, LOW);
  shiftOut(data, clock, MSBFIRST, table[num]);
  digitalWrite(latch, HIGH);
  digitalWrite(digit[SelectDigit], LOW);
  delay(timer);
  digitalWrite(digit[SelectDigit], HIGH);

}

//main program
void loop() {
  for (int i=0; i<10; i++){
    for (int j=0; j<10; j++){
      for (int k=0; k<10; k++){
        RunNum(k, 0);
        RunNum(j, 1);
        RunNum(i, 2);
        delay(1000);  //  <====    This line affects the project
      }
    }
  }
}

I updated my code (only void loop()) as below using millis(). You can watch the results (Click Here). But, the delay problem has not been solved so far!
const long interval = 1000;   //  1000 ms = 1 s
long previousMillis = 0;
unsigned long currentMillis=0;

//main program
void loop() {
  for (int i=0; i<10; i++){
    for (int j=0; j<10; j++){
      for (int k=0; k<10; k++){
        while (currentMillis - previousMillis < interval){
          currentMillis=millis();
          RunNum(k, 0);
          RunNum(j, 1);
          RunNum(i, 2);
        }
        previousMillis = currentMillis;
      }
    }
  }
}


texts: why esp8266 failed on AT commands 2nd time?

texts:
i have run the esp8266. and very first time i get all ok response and got data from server. but when second time esp8266 runs in the same loop of arduino then it is failed on all At commands.
and when i press the arduino reset button then again esp8266 response is ok on all commands?
so why esp8266 cannot show response ok on At commands when it runs 2nd time in the same loop?


texts:
I want it running as a normal automatic door so both sensors work as a separate activate. The only problem I've seen is that the servo remains active waiting for another high read and you can hear the buzz of it trying to keep position.

It didn't used to do this before the code change. While its open, if it reads another high it will remember and rerun the open wait close after it closes.

Eg. The door activates and while open 3 people walk thru so when the door closes it will then run 3 more times with out anyone being there.

Edit: Code changed

    #include <Servo.h>

  Servo myservo;

  int pos = 0; //variable to store servo position

  //amount of time we give the sensor to calibrate(10-60 secs according to       the datasheet)

  int calibrationTime = 30;

  int pirPin = 12; //digital pin connected to the PIR's output
  int pirPos = 13; //connects to the PIR's 5V pin
  int pirPin2 = 6; //digital pin connected to the PIR's output
  int pirPos2 = 10; //connects to the PIR's 5V pin
  const int position_closed = 0;      // door closed position [deg]
  const int position_open = 90;      // door open position [deg]
  const uint32_t delay_step = 15;     // delay between servo steps [ms]
  const uint32_t delay_open = 60000;  // how long the door stays open [ms]

  void setup()

  {
      myservo.attach(4); //attaches servo to pin 4
Serial.begin(9600); //begins serial communication
pinMode(pirPin, INPUT);
pinMode(pirPos, OUTPUT);
digitalWrite(pirPos, HIGH);
pinMode(pirPin2, INPUT);
pinMode(pirPos2, OUTPUT);
digitalWrite(pirPos2, HIGH);

//give the sensor time to calibrate
Serial.println("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++)
{
    Serial.print(calibrationTime - i);
    Serial.print("-");
    delay(1000);
}
Serial.println();
Serial.println("done");
  }

  void loop()
  {
static enum { CLOSED, OPENING, OPEN, CLOSING } state;
static int position;          // door position
static uint32_t last_change;  // last time state or position changed
uint32_t now = millis();

// When presence is detected, switch to the OPENING state.
if ((digitalRead(pirPin) == HIGH || digitalRead(pirPin2) == HIGH)
        && state != OPENING) {
    state = OPENING;
    last_change = now;
}
else switch (state) {
    case CLOSED:
        break;
    case OPENING:
        if (position == position_open) {
            state = OPEN;
            last_change = now;
        } else if (now - last_change >= delay_step) {
            myservo.write(++position);
            last_change = now;
        }
        break;
    case OPEN:
        if (now - last_change >= delay_open) {
            state = CLOSING;
            last_change = now;
        }
        break;
    case CLOSING:
        if (position == position_closed) {
            state = CLOSED;
            last_change = now;
        } else if (now - last_change >= delay_step) {
            myservo.write(--position);
            last_change = now;
        }
        break;
      }
  }


texts: PCF8563 does not remember time when restarting Arduino Uno?

texts:
I'm trying to use the following RTC module (PCF8563) with Arduino Uno.

I am using this library to set/get time and date from PCF8563. However, whenever I shut down the Arduino, the time/date is lost! Even though, as you can see in the picture, the module is equipped with a 3V battery to keep running when Arduino is unplugged.

Any help would be highly appreciated!


texts: Sending value from Arduino to MySQL using ESP8266

texts:
I am trying to send a value from Arduino to a remote MySQL. I am following this tutorial.

I have tried but no data is received on the server. What is the issue? I am new to Arduino. My code is:

int led1=8;
int count=1;
void setup() {
  pinMode(led1, OUTPUT);
  delay(3000);
  // initialize serial communication at 9600 bits per second:
  Serial.begin(115200);
  Serial.println("AT+CWMODE=1");
  delay(1000);
  Serial.println("AT+CWJAP=\"mhboys\",\"mhboys123\"");
  delay(1000);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led1,HIGH);
  // turn the LED on (HIGH is the voltage level)
  delay(1000);  // wait for a second
  if(digitalRead(led1)==LOW) {}
  if(digitalRead(led1)==HIGH) {
    count++;
    //code for sending updated count to mysql
  }
  digitalWrite(led1, LOW);
  // turn the LED off by making the voltage LOW
  delay(1000); // wait for a second
  int adjustedValue = count;
  // print out the value you read:
  Serial.println("AT+CIPSTART=\"TCP\",\"www.onemediagroup.in\",80");
  delay(1000);
  Serial.println("AT+CIPSEND=66");
  delay(1000);
  Serial.print("GET /energy/getUsage.php?currentValue=");
  Serial.print(adjustedValue);
  delay(1000);
  Serial.println("AT+CIPCLOSE");
  digitalWrite(13, HIGH);
  delay(100000); // delay in between reads for stability
}


texts: Controlling image display on LED matrix by buttons

texts:
Building a 9x9 LED matrix and facing following 2 problems in Arduino code,

The current code displays 2 images (using byte arrays and then using bitRead) one by one, each for a certain duration of seconds. Persistence of vision is obtained by a delay of 300ms. There is a subroutine called upon in the main loop function with arguments of desired byte array and duration. I want to control the images by using 2 push buttons (push button1 and it displays 1st image until button2 is pressed, push button2 and second image is displayed until button1 is pressed). But the scanning algorithm exits the scan routine upon completion of the given input duration and restarts the routine with new argument (byte array of image2). I WANT THE IMAGE TO BE RETAINED ON THE MATRIX UNTIL BUTTON IS PRESSED. Can't figure out how to accomplish this.

If i nest the routine in a DO WHILE loop, then my problem is that how will the buttons be read from the main loop? Because I believe as long as the subroutine is being executed, main loop will be halted. (or I am totally wrong in this assumption?)

Reference code which I intend to manipulate. (Here its for an 8x8 Matrix. Thats not an issue)

byte bigHeart[] = {
    B01100110,
    B11111111,
    B11111111,
    B11111111,
    B01111110,
    B00111100,
    B00011000,
    B00000000};

byte smallHeart[] = {
    B00000000,
    B00000000,
    B00010100,
    B00111110,
    B00111110,
    B00011100,
    B00001000,
    B00000000};

const int columnPins[] = { 2, 3, 4, 5, 6, 7, 8, 9};
const int rowPins[] = { 10,11,12,15,16,17,18,19};

void setup() {
    for (int i = 0; i < 8; i++)
    {
        pinMode(rowPins[i], OUTPUT); // make all the LED pins outputs
        pinMode(columnPins[i], OUTPUT);
        digitalWrite(columnPins[i], HIGH); // disconnect column pins from Ground
    }
}

void loop() {
    int pulseDelay = 800 ; // milliseconds to wait between beats
    show(smallHeart, 80); // show the small heart image for 100 ms
    show(bigHeart, 160); // followed by the big heart for 200ms
    delay(pulseDelay); // show nothing between beats
}

// routine to show a frame of an image stored in the array pointed to by the
// image parameter.
// the frame is repeated for the given duration in milliseconds
void show( byte * image, unsigned long duration)
{
    unsigned long start = millis(); // begin timing the animation
    while (start + duration > millis()) // loop until the duration period has passed
    {
        for(int row = 0; row < 8; row++)
        {
            digitalWrite(rowPins[row], HIGH); // connect row to +5 volts
            for(int column = 0; column < 8; column++)
            {
                boolean pixel = bitRead(image[row],column);
                if(pixel == 1)
                {
                    digitalWrite(columnPins[column], LOW); // connect column to Gnd
                }
                delayMicroseconds(300); // a small delay for each LED
                digitalWrite(columnPins[column], HIGH); // disconnect column from Gnd
            }

            digitalWrite(rowPins[row], LOW); // disconnect LEDs
        }
    }
}


texts: Can both the 3.3V and 5V pins on the Arduino be used at once for power?

texts: I'm supplying power to Arduino via PC USB.


texts:
Many electronic devices turn on/off, or more correctly on/sleep, by pressing a button and holding it for two or three seconds. I would like to put this ability into a project using an Adafruit Feather board.  The sleep side is easy, I can detect a level and if it stays there for some time, run the code to put the processor to sleep.  My question involves the wake up side. The chip wakes up via an interrupt.

The question then becomes, how do I generate the interrupt source only after the button has been held for the designated time? I've considered two options:

1) Use a level interrupt and an RC circuit to do the delay.
2) Have the processor wake up immediately and then implement logic to determine if it has been held "long enough" and go back to sleep if not.

Am I missing an easy option? Is there a general consensus on the best way to do this? It seems like such a normal thing that I'm surprised my searches haven't turned up any tutorials.


texts: Which Arduino board to select for designing a Quadcopter?

texts:
I want to design a Quadcopter. I am a novice and would like to start off with the basic Arduino that can support making a Quadcopter.

Which Arduino board will be good...?

Also, I plan to add Android interface later.

Also, can anybody suggest places in India where Arduino boards are available so I can buy one..?

Thanks!


texts:
This is weirding me out. So I wrote to the EEPROM and I would like to read from the address and format it in Base 10, err... Decimal. The normal number thingy that's not ASCII. But it keeps returning ASCII values when I write:
Serial.println(EEPROM.read(address), DEC).
Wait for the weird part, when I format in other bases like, say BIN, or OCT, it outputs in the correct base. Please help. Here's the full snippet of the tiny program.
#include <EEPROM.h>
int addr = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
  if(Serial.available() > 0){
    int rc = Serial.read();
    EEPROM.write(addr, rc);
    Serial.println(EEPROM.read(addr), DEC);
  }

}


texts: Switch a 12V 3.3A component from an Arduino

texts:
I need turn off and turn on component from an Arduino UNO.

How can I do that? I am thinking about some transistor (IRF 530N) but I am not sure about it.

Please give me a beginner advice how to implement such a switch.

EDIT: Is this realy good for my problem?


texts: please tell me how do I fix this code down here(please tell in my easy English)

texts:
LiquidCrystal 1cd(12, 11, 5, 4, 3, 2);

 void setup() {
   1cd.begin(16, 2);
   1cd.print"abbu, kya, chalrelaye!");
 }

 void loop() {

 }


texts: Arduino Nano Every Vin 5V fixes I2c problems

texts:
I had problems with connecting my devices via I2C. The "requestfrom" constantly hanged and the endtransmission sometimes gave NACK responses.
After disconnecting the devices from 12V and powering one of them via USB (vin with which it was connected to the other arduino's became 3.8V) they stopped misbehaving and worked together in harmony.
How is this possible? Am I missing something? An Arduino Nano Every should be driven between 6-21V?
All devices are "Arduino Nano Every"'s. They used to get 12V directly on Vin and are connected together in a chain by Vin,GND,A5(SCK),A4(SDA)
The master is in the middle of the chain so that the distance is max 20cm.
I also tried powering them via vin with 9V and 5V. Had the same issue.
Already big thanks for the help.


texts: Bootloader difference between Atmel328p(through hole) and Atmel328p au(smd)

texts:
It’s been bugging me lot that Can’t we burn the same bootloader for both 328p and 328p au?

I got confused when I see this linksmd 328p au bootloader burn.

Will there be any impact on performance or any other impact if I use same bootloader for both?


texts: error: expected primary-expression before ',' token


texts: Make something happen on a continous input just once and for a specific amount of time

texts:
My project is very complicated, but here is a visual synthesis

The input actually comes from a kinect, that detects a person position through Processing, which I connected via Serial to Arduino.
Whenever my trigger is activated, a character is sent to arduino.
What I need to make everything work properly is, upon the said input, some lines of code have to be executed once and for a specific amount of time. And upon repeated input, these lines must not be executed until the input changes.

A semplified version would be: I press a button, led turns on for one second and then turns off (even if i'm still pressing it). led doesn't turn on again until i stop pressing and press again. Obviously in my project the input is the character received via serial and the output is the motor to turn on for some time, and then turn off.

I wanted to make the serial thing specific because i think it makes the thing a little bit trickier than the led example.


texts:
How to reduce sketch size?

I got an error that “Sketch uses 30,044 bytes (104%) of program storage space. Maximum is 28,672 bytes.”

I can't reduce function in sketch.I can't change ATmega32u4,now.
The sketch has function of measuring sensor,logging on SD,connection with BLE module.

So please tell me hack.

Or,how to increase flash memory size?

I tried to change type of String to Char.


texts: The board is not uploading the code and returning the error message below. I use Ubuntu 18.04

texts:
Arduino: 1.8.6 Hourly Build 2018/04/03 01:25 (Linux), Board: "Arduino/Genuino Uno"

Archiving built core (caching) in: /tmp/arduino_cache_780208/core/core_arduino_avr_uno_03c9c57cd21d897953e1b8d569949415.a
Sketch uses 926 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
java.io.IOException: Cannot run program "{runtime.tools.avrdude.path}/bin/avrdude": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at java.lang.Runtime.exec(Runtime.java:485)
    at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
    at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
    at processing.app.SketchController.upload(SketchController.java:713)
    at processing.app.SketchController.exportApplet(SketchController.java:686)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2170)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 10 more
An error occurred while uploading the sketch

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


texts: How to arrange my code block to make it work smooth and correct

texts:
I currently working on my system that automatically water the plant based on the water requirement of the plant for one day . I have a java application that let the user input the water requirement of the plant and then the java application send it to arduino the arduino will receive the data and put it inside the variable and it will be use .. I use the following sensor/module ..

SOIL MOISTURE 2 PCS.
WATER FLOW SENSOR 2 PCS.
SOLENOID VALVE 2PS
WATER LEVEL SENSOR 1 PCS.
HUMIDITY SENSOR 1 PCS.
REAL TIME CLOCK DS3231

The data that the java app will send is the water requirements for 1 day for example 400ml , the 400ml will be used by the water flow sensor if the sensor reads that its already 400ml has pass in the tube the solenoid will close the pipe . And my system has a water tank the water sensor is attach to it and will check if the water in the tank is not low if low the arduino will send that data into the java app .. All the sensors reading will be save into database using the java application ..

Here is My Whole code for arduino , its not finish yet because i'm stuck thinking on how to arrange my code blocks . Sorry for my English please bear with me ..

#include <DS3231.h>

//PINS
#define MOISTURE1 A15
#define MOISTURE2 A14
#define WATERFLOW1 A13
#define WATERFLOW2 A12
#define HUMIDITY A11
#define RELAY1 9
#define RELAY2 8
#define ALARM 2

DS3231  rtc(SDA, SCL);
int DELAYNI = 1000;
void setup() {
  // put your setup code here, to run once:
pinMode(MOISTURE1, INPUT);
pinMode(MOISTURE2, INPUT);
pinMode(WATERFLOW1, INPUT);
pinMode(WATERFLOW2, INPUT);
pinMode(HUMIDITY, INPUT);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);

rtc.begin();

Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:

  //Some Code here to get the data send by java app and then assign it to each variable

  readMoistureStatus();
  readWaterLevel();
}
void readWaterLevel(){
  ///Some code here
}

void readMoistureStatus(){

 int  moistureOneSensorValue = analogRead(MOISTURE1);
 int  moistureTwoSensorValue = analogRead(MOISTURE2);

   // checking the moisture range for the first soil moisture
  if(moistureOneSensorValue >= 700){
    // in case of dry soil:
    RelayOne();

     delay(DELAYNI);
  }
  if((moistureOneSensorValue < 700) && (moistureOneSensorValue >= 300)){
    // in case of moist soil:

    delay(DELAYNI);
  }
  if(moistureOneSensorValue < 300){
    // in case of soggy soil:

    delay(DELAYNI);
  }
   //
   //
   // Checking the moisture range for the second soil moisture

  if(moistureTwoSensorValue >= 700){
    // in case of dry soil:
    RelayTwo();

     delay(DELAYNI);
  }
  if((moistureTwoSensorValue < 700) && (moistureTwoSensorValue >= 300)){
    // in case of moist soil:

    delay(DELAYNI);
  }
  if(moistureTwoSensorValue < 300){
    // in case of soggy soil:

    delay(DELAYNI);
  }

}

void RelayOne(){
  //Close or Open the Solenoid

  //Read the water flow if the set point is reach it will close the solenoid using the relay
}

void RelayTwo(){
  //Close or Open the Solenoid

 //Read the water flow if the set point is reach it will close the solenoid using the relay
}


texts: Tone() conflicts with IRremote library (multiple definition of `__vector_7')

texts:
I have just started with Arduino and C++ so I apologise if my question is very basic.
I am trying to use tone() with a passive buzzer to create a sound while also using the IRremote library for a remote. However, whenever they are used together, it gives this error:

  Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':

  (.text+0x0): multiple definition of `__vector_7'

  libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0):
  first defined here

  collect2.exe: error: ld returned 1 exit status

  exit status 1

  Error compiling for board Arduino/Genuino Uno.

This is the code required to recreate this error:

#include "IRremote.h"
#include "pitches.h"
int melody[] = {NOTE_C5, NOTE_E6};

void setup() {}

void loop() {
 for (int thisNote = 0; thisNote < 2; thisNote++) {
 tone(3, melody[thisNote], 300);
}
}

Please could you advise me on how to fix this issue and if necessary, on a different library or way to create a sound or to receive IR signals?


texts:
I have a connector with 10 pins, and a bus which uses 2 of the 10 pins.

What I need to do is, in software, attach my arduino to 2 of the 10 pins. I cannot wire it directly as the 2 pins required may be in a different position in different environments.

What are my options?

EDIT: Just some background. I have to connect to an OBD II port of a vehicle and cannot to the CAN bus. On some vehicles is may not be on the standard pins in the OBD connector, so I would like to be able to programatically switch the pins being used, in software.


texts: How does this Motor Circuit not ruin the Microcontroller

texts: I came across this instructable about using no external hardware but two pwm pins to control a motor in both directions. Usually you would use an H bridge. However, ever since I have had my Arduino I have heard that you are not supposed to connect a pin to another pin. So how does this circuit works. It looks like he sends a signal from one pin and in my experience it would fry the board. So basically, my question is this circuit ok with an Arduino Nano and if so how does it work? Below is a picture of the setup he gave:


texts:
I am designing a board for my electronics project and i am using a number of ATTiny85 for it. The ATTiny's will be SMD so i will not be able to remove them for programming.

Moreover all of the pins of my uCs will be used for connections (apart from reset).

Is it possible in this case to achieve that, any ideas and suggestions are welcome

EDIT: Well, Vcc and Ground will be common, i will be using an external oscillator for all of them, the reset pin will be free, the other three pins will be used for gpio communication between the attinys.
I am connecting about 10 attiny in a daisy chain kind of thing


texts: Unable to write, or read a sensor's registers. Do I have an error in my code?

texts:
I'm trying to write to register the change some settings for a sensor I'm using (BNO055) and then read the same register to verify if the changes are successful.
However, the only value I'm able to read from the register is 1. Is the issue with my code or something to do with the sensor?
Thank you for your help. I've included what I think the relevant code is.
/**************************************************************************/
void write_register(uint8_t sensor_address, uint8_t register_address, uint8_t register_value) {
  wire_custom.beginTransmission (sensor_address);
  wire_custom.write(register_address);
  wire_custom.write(register_value);
  wire_custom.endTransmission ();
}

/**************************************************************************/
byte read_register(uint8_t sensor_address, uint8_t register_address, uint8_t bytes) {
  uint8_t result;
  wire_custom.beginTransmission (sensor_address);
  wire_custom.write(register_address);
  wire_custom.endTransmission ();
  wire_custom.requestFrom(sensor_address, bytes);
  result = wire_custom.read();
  return result;
}

/**************************************************************************/
void setup(void)
{
  wire_custom.begin(I2C_SDA, I2C_SCL, 400000);

  Serial.begin(115200);

  if (!bno.begin())
  {
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
    while (1);
  }
  delay(1000);
  bno.setExtCrystalUse(true);

  // updating range
  bno.setMode(Adafruit_BNO055::OPERATION_MODE_CONFIG);
  delay(1000);
  write_register (0x28, 0x0A, 0b00111000);
  // bno.setMode(Adafruit_BNO055::OPERATION_MODE_GYRONLY);
  delay(1000);
  register_1 = read_register (0x28, 0x0A, 1);
}

/**************************************************************************/
void loop(void)
{
  sensor_calibration ();

  sensor_data (x_placeholder, y_placeholder);

  // printing register 1
  Serial.print(register_1);
  Serial.print("\n");
}


texts: What do I need to make fluffy toys move and talk?

texts:
My kids got many fluffy toys, and I would like to make them move and talk. Something like a small platform with wheels and a speaker and some sensors that I would be able to mount any of the toys on.

I'd like to build something like 2 platforms with motors and sensors that move around, and when encountering obstacles "bark" at them through the speakers, wait random number of seconds, and move in different directions. Then the kids would mount their favorite fluffy dogs/cats/bears/rabbits on top of these platforms and unleash them on each other.

I am very new to DIY; what do I need to buy for such a project?


texts:
I am having some trouble programming 3 servos to move like a wave.  So, for instance, all my servos start at 90 degrees. I want my first servo to move and when it reaches 135 degrees I want my second servo to move, with the first, then when it reaches 135 degrees I want my third servo to move, with the first and the second. Then go backwards. Does that make sense?

Here is what I have so far.

#include <Servo.h>

//Create servo object to control a servo
Servo left;
Servo middle;
Servo right;

//Variables to store the servo position
int post = 180;
int post2 = 90;
int back = 90;
int forward = 135;

int firstTriggerAngle = 135;
int secondTriggerAngle = 180;

//Delay
int mid = 4;

void setup()
{
  Serial.begin(9600);

  //Attaches the servos on the pins of the arduino to the servo object
  left.attach(4);
  middle.attach(3);
  right.attach(2);

  //Starting position
  left.write(back);
  middle.write(back);
  right.write(back);
}

void loop()
{
  for (int i=back; i>=forward; i+=1)
  {
    left.write(i);
    if( i > firstTriggerAngle)
    {
      post = map(i, 90, 135, 135, 90);
      middle.write(post);
    }
    if(post > secondTriggerAngle)
    {
      post2 = map(post, 90, 135, 135, 90);  // depends on the angles you use
      right.write(post2);
    }
    delay(mid);
 }
}


texts: How can i increase the range of values that a light sensor gives?

texts:
I have constructed 2 ceptometers that measure light intensity. Each ceptometer consists of 50 photodiodes that are connected to 2 copper wires (+ and - of the photodiodes are on the same orientation). Those wires are soldered with cable (+ to the copper wire where the positive side of the photodiodes is and the ground wire soldered to the copper wire where the negative side of the photodiodes is). Then, pins were soldered to the cables so as to can be connected to the breadboard.
The paper where the protocol for the construction is present, states that a 1.5 ohms resistor needs to be connected to the copper wires so as to enhance the range of the signal that the ceptometers will give. However, it mentions that this step can be followed later and the resistor can be connected to the wires (that is something that makes sense). I need to mention that one more ceptometer is present that was constructed by another person the previous year and it has the 1.5 ohms resistor soldered on the copper wire. It is something very important to keep in mind for the rest of the text!
I decided to use an arduino uno for my experiment and I connected the 3 ceptometeres (the old from the previous year and the 2 that were constructed by me) to a breadboard. Firstly, I applied light to the ceptometers with a projector and I tried different resistors from 470R to 5K but the values I got were the same. I thought that a kind of signal disturbance or noise may has been caused and I made 3 opAmp circuits in 3 different breadboards. When the breadboards were connected to the Arduino I tried the same resistors again but the values I got were the same. For the old ceptometer that has the 1.5 ohms resistor soldered to the copper wires the change of resistors altered a lot the signal and it gave a wide range of values. Here I have to say that when I applied to the 1.5 ohms resistor to the new captometers I got a pure 0 as a value. And it was the same when I placed them under sunlight.
When I converted the output of the Arduino to voltage signal by multiplying it with 5 and then divide it with 1023 I had the same voltage signal as when I measured it with the multimeter. And it was the same under both artificial and sun light. So, I can imagine that it is something that depends on the resistor that is not applied to the copper wires. I mean that maybe this is the case that I do not get a wide range of values like the old ceptometer but only 20 units
My question is: Do you know any way to enhance the range of the output or do you have any recommendation? Thank you a lot in advance!
With kind regards,
Dimitrios


texts:
When I run my code, the ESC makes some noises, different on the high pulse and low pulse, then it begins to jiggle for a bit when it gets to the loop. Here is the code:

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 1000
#define MOTOR_PIN 10

Servo motor;

void setup() {
  Serial.begin(9600);
  Serial.println("Program begin...");
  Serial.println("This program will calibrate the ESC.");

  motor.attach(MOTOR_PIN);

  // Wait for input
  while (!Serial.available());
  Serial.read();

  Serial.println("Now writing maximum output.");
  motor.writeMicroseconds(MAX_SIGNAL);
  delay(2000);

  // Send min output
  Serial.println("Sending minimum output");
  motor.writeMicroseconds(MIN_SIGNAL);
  delay(2000);

}

void loop() {
  motor.writeMicroseconds(MAX_SIGNAL);
}


texts:
I have been browsing the internet for about 3 hours now, it appears other people have had the same problem but I can't find a solution for it.

Basically yesterday I received my first GSM module and I was playing around with some AT commands in the serial monitor and it was working absolutely fine, today I'm getting nothing.

It's not related to the module though, even the basic SoftwareSerial example doesnt work now. All that's printed is "Goodnight moon!" and it never prints "Hello, world?". It's like it's not able start the serial communication or something.

Any help would be much appreciated!

 #include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }

  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}


texts: How to connect components without using a breadboard?

texts: I am in learning path of Arduino and IoT, I am preparing a project for fire system, but I am stuck in how to connect fire sensor, buzzer, led, and laser sensor without using breadboard. Please anyone help me out.


texts:
Arduino Uno R3, WS2812B, 1 strip of 60 leds, segmented in to 4.
Problem: Only want a single segment/fx_mode to run at any one time.

#include <WS2812FX.h>

#define LED_COUNT 60

#define LED_PIN 13

WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {

ws2812fx.init();

ws2812fx.setBrightness(85);

// divide the strip of 60 LEDs in to 4 segments

ws2812fx.setSegment(0,  0, 14, FX_MODE_COMET, BLUE,  3000, false);

ws2812fx.setSegment(1, 15, 29, FX_MODE_SCAN, RED, 3000, true);

ws2812fx.setSegment(2, 30, 44, FX_MODE_SCAN, BLUE,  3000, false);

ws2812fx.setSegment(3, 45, 60, FX_MODE_SCAN, RED, 3000, true);

ws2812fx.start();
}

void loop() {

ws2812fx.service();
}


texts:
As I was trying to program my ATtiny chip with my arduino, I ran across some problems. Note that I know that this problem is faced almost in every Q and A site and forum so don't flag me as repeat yet. (I was trying to burn the bootloader so my chip runs at 8MHz)

So this is the error code:

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -v -v -v -pattiny85 -cstk500v1 -PCOM1 -b19200 -e -Uefuse:w:0xff:m -Uhfuse:w:0xdf:m -Ulfuse:w:0xe2:m

 avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2014 Joerg Wunsch

 System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

     Using Port                    : COM1
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03

avrdude done.  Thank you.

Error while burning bootloader.

* deleted attempt 2 to 9 *

Although a solution to this problem will be very nice, that is not my intention here. I tried almost all solutions I have found and non of them work, and I want to know why. So these are my questions:

What does this code actually mean? The for example the "programmer", is it referring to the Arduino or the ATtiny(or the highly unlikely, laptop that im using.)
How do I access more error codes, if there are any, as I think that these codes really do not tell that much.
[Solved]To prevent Arduino from auto-resetting, almost all tutorials connect the Reset pin to the Ground pin with a 10uF capacitor, and I don't have one. I tried with various other capacitors that I have(22uF, 0.4uF, 0.22uF, 47uF, and 330uF). I do not know how does the capacitance affect the anti auto-resetting function, so some explanation here is helpful.
[solved]

EDIT: I disconnected the ATtiny and the same error code persists. This, I conclude as either I never had a proper connection with the ATtiny, or the problem is with the communication of my laptop with the Arduino.


texts: why my arduino uno r3 restart when plugged in to a battery(9v)

texts:
i have a personal challenge that is to make a arduino avoidance robot it has a"hc-sr04 ultrasonic sensor, a servo, bread board(for the sharing of vcc and gnd), l9110s motor driver, and two dc motors, and also the arduino uno itself"
but when i assembled it and upload the code it works if it's plugged in my laptop but if i plugged it in to a battery it keeps on restarting and doesn't run


texts: Arduino, problem with interrupt and SSD1306 OLED

texts:
I'm not that good at this. Calculates RPM through Peripheral Speed and Interrupt.
Everything works fine when I show this in the IDE with Serial.print without OLED. When I connect an SSD1306 OLED I2C, the interrupt stops working. No serial.print.
If I uncomment the display.display(), Same problem with display.setRotation(90): everything is fine and serial.print starts working, but of course not the OLED.
In the code I have a void addressing, visadisplay(). If I put this addressing in void loop () then everything works but then there is a risk of unsynchronization, wrong values. I have also removed visadisplay(); without change.
Help...
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Function for serial display.
// Connections for Nano.
// Hall sensor connection: (Signal out) --- (D2).
// Display connection: (SDA) --- (4A) / (SCL) --- (A5)

volatile unsigned long PulsTid = 0UL;
volatile unsigned long StartTid = 0;
volatile unsigned long SlutTid = 0;
volatile unsigned long CalcTid = 0;
volatile float omkrets = 7.5;
volatile float HastighetPerferi = 0;
volatile unsigned long Rpm = 0;
volatile float Vinkel = 0UL;

void isr() { // interrupt service routine
  Vinkel = 0;
  StartTid = millis();
  CalcTid = SlutTid;

  detachInterrupt(0);             //detaches the interrupt while calculating

  PulsTid = (StartTid - SlutTid);
  HastighetPerferi = (omkrets / PulsTid);
  SlutTid = StartTid;
  Rpm = ((HastighetPerferi / (omkrets / 1000) * 60) / 2); // Calculate speed

  visadisplay();
  attachInterrupt(0, isr, FALLING);  //attaching the interrupt again
}

void visadisplay(void) {
  Serial.print("Varvtal: ");
  Serial.println(Rpm);

  display.setRotation(90);
  display.clearDisplay();
  display.setTextSize(1);              // Text size.
  display.setTextColor(SSD1306_WHITE); // White text.
  display.setCursor(0, 0);             // Start position
  display.println("RPM: ");
  display.setCursor(40, 10);
  display.setTextSize(2);
  display.print(Rpm);
  display.display();
}

void setup() {
  Serial.begin(115200);
  attachInterrupt(0, isr, FALLING);  //attaching the interrupt

  //SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
}

void loop(){
}