texts: Is there an ICRn CTC mode interrupt vector?

texts:
I can use the CTC waveform generation mode to loop to OCRnA and trigger the corresponding TIMER1_COMPA_vect interrupt.

// CTC mode
TCCR1A &= ~(1 << WGM10);
TCCR1A &= ~(1 << WGM11);
TCCR1B |= (1 << WGM12);
TCCR1B &= ~(1 << WGM13);
TIMSK1 |= (1 << OCIE1A);
OCR1A = 250;

ISR(TIMER1_COMPA_vect) {}

But if I use CTC mode with ICRn as "TOP" is there a corresponding interrupt vector?

TCCR1A &= ~(1 << WGM10);
TCCR1A &= ~(1 << WGM11);
TCCR1B |= (1 << WGM12);
TCCR1B |= (1 << WGM13);
TIMSK1 |= (1 << ???);    // which interrupt to enable?
ICR1 = 250;

ISR(???) {}              // which interrupt vector?


texts: The ESP8266 connects to open WiFi hotspots, even If I supply a password

texts:
This question is more out of curiosity, then out of a need to solve something.

I was trying out some experiments with the ESP8266 Arduino core when I realized that I had programmed an SSID and password for the ESP8266, but the WiFi that I had set up was an open network.

I tried going through the documentation and then the Arduino core source code, but couldn't find if WiFi.begin(ssid,passphrase) a function does this on purposes, as in it was designed that way, or did it just happen to work this way.

Also, I would like to know if there is a way to stop the ESP from connecting to an open network when the passphrase is provided.


texts: Creating and Arduino synthesizer without the tone library

texts: I am thinking about trying to make an Arduino synthesizer using the true analog output on the Due. However I would like to be able to play multiple notes at the same time on a single buzzer. Is this possible and how would I do it?


texts: Reading out two sensors via Com-Port at the same time

texts:
I have two Arduino Nano Every and a sensor connected to each of them. Here is what's happening:

I upload the sketch to the first Arduino on Com4 and see its output is correct via the Serial Monitor
I open a new instance of the Arduino-software, upload the same sketch to the second Arduino on Com6 and see its output is correct. However, in the meantime the Arduino on Com4 has stopped sending or receiving data
If I close the second IDE-instance and re-upload the sketch to the first Arduino on Com4, it starts working again.

So, essentially I have two Arduinos which I can't read out at the same time.

The sensors are not connected, so I don't know where the problem is. Shouldn't the Com-Ports be independent?


texts: I want to stream audio from an Arduino to a device on the wifi

texts:
I only started learning Arduino recently. This is my first project.
So the idea for the project is that there will be an Arduino board(Ideally an Uno but I don't know if another board would be better) and when you hold a button down it will transmit what you are saying to a device on the wifi. I know I will have to get a WiFi module and like a microphone and button, so can you help me figure out just the gist of how the project will go and what parts I should get.
Thanks!


texts: Arduino countdown timer for repeating actions

texts:
I have tried to find simple library for triggering timer after some time.
The idea is to retry network connection (RF24 network library).

I have following code now

while(!mesh.write(message, headerType, memSize)) {

}

This code will try to send packet until success

But I need to give up after for instance 10 seconds

I wanna to have something like this

bool timerTriggered = false;
Timer myTimer = new Timer(10000);
myTimer.setCallback(countedDown);

void countedDown() {
   timerTriggered = true;
}

And start timer before network request

myTimer.start();

while(!mesh.write(message, headerType, memSize) || !timerTriggered) {

}

Please suggest the best way to implement this.

Thanks.

EDIT

I have found problem as far as delay(); uses timer internally it conflicts with libraries or simple timer.

The solution is to use Alarm.delay(400); instead.

Maybe someone knows better solution ?


texts: Arduino app hangs on upload for all boards

texts:
I'm at a loss. I have many boards and have not had much trouble in the past uploading to feather, uno, light blue bean and others. I have a lot of boards loaded in the board manager and I'd rather not delete everything just yet.

But, after taking a month off of arduino programming I've come back to the app to discover that I can't upload anything to any board. I've tried a brand new uno, an adafruit feather and the light blue bean. In each case I can see the port, but the upload just hangs like this:

On the board the light that normally blinks during upload never blinks. It's like the upload just isn't happening. But there is no error in the app.

I tried reinstalling the app, but that didn't help. My next thought is to delete everything, and do a fresh install. Which will be annoying. Is that my only hope?

UPDATE:

Here are the settings from the tools menu as requested:


texts:
How can I get an Arduino to do the following to a Stepper Motor installed on a "Lead-screw" attached to my table-saw's Fence?

Turn the "lead-screw" clockwise when I press a given button, UNTIL I release the button.
Turn the same "lead-screw" counter-clockwise, when I press another button, UNTIL I release the button.
Adjust a "speed" knob, to control the motor's speed when the fence is moving; from very fast to very slow; and even stop when the control is completely counter-clockwise.
Turn a switch off, which will remove all control to the motor; so I can turn the shaft manually without resistance, whenever I do not want the fence to be under control of the motor.

That is ALL I need.

It is that simple. So what do I need? What do I need to purchase? I am a novice.


texts: Can anyone tell me if it is possible to send a sketch to Arduino directly from Visual Studio?


texts: What is the cheapest way to add wifi to Arduino?

texts:
I am trying to find some sort of wifi adapter for Arduino, it needs to be as small as possible (not a shield) and as cheap as possible.

So far I can only seem to find shields that cost about £10+ but I figured that if you can get a replacement wifi adapter for a laptop for next to nothing that I should be able to get a wifi adapter for Arduino much cheaper than this.

It's possible I just don't know what to search for.


texts:
I am working on a project where I am trying to get an input signal filtered according to its frequency. I checked the signal before it went into my DSP algorithm to see where the problem was and I found that the frequency was remaining the same no matter if I put in 30Hz 120Hz or 58kHz. This leads me to think I have a problem with the sampling rate. Does that sound like it is the actual issue? Or am I barking up the wrong tree?

I was just using the readADC command to read in the data

void setup()          //Setup Function to intialise ADC and Serial Communication
{
DDRC=0x00;            //PORTC as INPUT
DDRD=0xFF;            //PORTD is OUTPUT
DDRD=0xFF;
for(i=0;i<N;i++)
  {
    InitADC();
    a=ReadADC(4);
    x[i]=a;
  }
  Serial.begin(9600);
}


texts: How many sensors can be supported by a single Arduino unit?

texts:
I am a beginner in the Arduino world. I made some basic projects of the book that comes with the starter kit (it's was borrowed by a friend of mine) and also I used a humidity, a temperature sensors and a LCD display.

I want to buy an Arduino Uno for measure room temperature, humidity, carbon monoxide, carbon dioxin and maybe a couple more variables. I will to use 4 sensors, 1 buzzer, 1 LCD display and 1 ESP8266 serial WIFI wireless module.

After this work I will add for functionalities but as I have a lot of components I am not sure if the Arduino Uno can supports them because it has a limited quantity of pins.

Do I need an Arduino with more pins? what if I use all these pins and I need more? Can the Arduino Uno be expanded with more pins?

As the Arduino Uno is a very small computer, can its processor support all these components and their operations?


texts:
I have two Arduino boards and want to make them communicate with each other over serial. The code I have used for the two boards is almost identical.

Every one second the "A" board sends a "ping" message over serial.
The "B" board receives the "ping" message and responds with a "pong" one.
The "A" board receives the "pong" message and prints it on screen.

Board A - ping code
String inputString = "";
boolean stringComplete = false;

void setup() {
  Serial.begin(9600);
  inputString.reserve(200);
}

void loop() {

  Serial.print("ping");

  if (stringComplete) {
    Serial.println(inputString);
    inputString = "";
    stringComplete = false;
  }
  delay(1000);
}

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == 'g') {
      stringComplete = true;
    }
  }
}

Board B - pong code
String inputString = "";
boolean stringComplete = false;

void setup() {
  Serial.begin(9600);
  inputString.reserve(200);
}

void loop() {

  if (stringComplete) {
    Serial.println("pong");
    inputString = "";
    stringComplete = false;
  }
}

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == 'g') {
      stringComplete = true;
  }
 }
}

The code seems to work, but not exactly as expected. I initiate the serial monitor of the board "A" and expect to see every one second:

pingpong

Instead I see this:

pingpong
pong
pong
....

which means that the pong message is repeated more than one time per second. But I want the "B" board to transmit the "pong" message only when it receives the "ping" one.
Why is this happening? Is there an error in the code? Is there a detail about the serial protocol which escapes me?
Any thoughts would be appreciated.


texts: How to trigger NodeMCU sketch from Arduino Leonardo Micro Pro?

texts:
So this is probably a very simple question. I have my NodeMCU set up and working where it connects to wifi and sends a push notification. Currently it does that automatically when connected to power.

What I want to do is connect it to my Leonardo Micro so that at a part in the Leonardo sketch it sends a signal to the NodeMCU to run the sketch to trigger the push notification. So simply, which ports should I connect and what code should I change.

Here is my working NodeMCU code.

    #include <ESP8266WiFi.h>

// Wifi Settings
const char* ssid = "MySSID";
const char* password = "MyPassword";
// Pushover settings
char pushoversite[] = "api.pushover.net";
char apitoken[] = "MyAPIToken";
char userkey [] = "MyUserKey";
int length;
WiFiClient client;
void setup() {
  Serial.begin(9600);
  delay(10);

  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

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

  // Print the IP address
  Serial.print(WiFi.localIP());

}

void loop()
{
 pushover("OMG, Yes it works!!!");
 delay(60000);
}

byte pushover(char *pushovermessage)
{
 String message = pushovermessage;

 length = 81 + message.length();

if(client.connect(pushoversite,80))
 {
   client.println("POST /1/messages.json HTTP/1.1");
   client.println("Host: api.pushover.net");
   client.println("Connection: close\r\nContent-Type: application/x-www-form-urlencoded");
   client.print("Content-Length: ");
   client.print(length);
   client.println("\r\n");;
   client.print("token=");
   client.print(apitoken);
   client.print("&user=");
   client.print(userkey);
   client.print("&message=");
   client.print(message);
   while(client.connected())
   {
     while(client.available())
     {
       char ch = client.read();
       Serial.write(ch);
     }
   }
   client.stop();
 }
}

And my Leonardo code

#include <Keyboard.h>
#include <Mouse.h>
char returnKey = KEY_RETURN;
char tabKey = KEY_TAB;
void setup() {
  Keyboard.begin();
  Mouse.begin();

  delay(4000); //Testing Delay
// Language Select Screen
  Keyboard.write(returnKey);
  delay(30000);
// Welcome Screen
  Mouse.click(MOUSE_LEFT);
  delay(100);
  Keyboard.write(tabKey);
  delay(100);
  Keyboard.write(tabKey);
  delay(100);
  Keyboard.write(' ');
  delay(2000);
// Select Keyboard
  Keyboard.write(tabKey);
  delay(100);
  Keyboard.write(tabKey);
  delay(100);
  Keyboard.write(tabKey);
  delay(100);
  Keyboard.write(' ');
  delay(2000);
  TELL NODEMCU TO SEND PUSH NOTIFICATION HERE
}

void loop() {
}

As a reminder the pinout on my boards are as follows.

Leonardo:

NodeMCU:


texts: Why echo "R" > /dev/ttyUSB0 doesn't work, but on the same PC Serial Monitor in Arduino IDE works?

texts:
I have a strange problem. I am running Ubuntu and NodeMCU si plugged into USB. I have very simple sketch running on it, when it reads letter "R" on serial, it turns ON relay.
When I open Serial Monitor in Arduino IDE and I type letter "R" and send it, it works perfectly. However when I run commands below, it does nothing:
stty -F /dev/ttyUSB0 115200
echo "R" > /dev/ttyUSB0

I tried running the same commands on different PC with Ubuntu and these system commands work just fine.
I also tried copying exact same configuration from stty -a -F /dev/ttyUSB from PC where it works to PC where it doesn't, but it didn't help either.
I don't think it's driver issue, because if it would, then I suppose it wouldn't work with Serial Monitor also.
Thank you for any help or hints in advance.


texts: In multidimensional arrays, can you use variable arrays or their names instead of the actual data?

texts:
Referring to this thread
How to declare and use "Variabled arrays" inside arrays
Example
byte array[2][4] = { {1,2,3,4}, {5,6,7,8} };
Serial.println(array[0][2]); is equal to '3'.

Instead of using {1, 2, 3, 4} and {5, 6, 7, 8} I want to be able to declare separate arrays for each of them and just put the name.
Another big issue is putting arrays of different sizes for each entry and it would be wrong to do so. Is this really not possible? Do I have to use some other concept instead if I want to have an array that contains entries of arrays that have different sizes? I heard about pointers but not familiar with that.
Example,
byte arrayX[3] = {1, 2, 3}
byte arrayY[4] = {5, 6, 7, 8}

byte array[2][4] = { arrayX , arrayY };

Take note that the code was not taken from the link I mentioned, I just used the same array names. Also I changed arrayX from the link to 3 entries because I want to emphasize the part of my question if it is possible if arrays have different sizes and you would just use the biggest size?
Now I think this is wrong and I haven't tested it currently but I want to ask if there is a solution that makes use of what I have mentioned? The site I linked to gave a solution which feels very redundant in terms of declaration and I would not want that. This is the solution mentioned there.
byte arrayZ[2][4] = {
  {arrayX[0],arrayX[1],arrayX[2],arrayX[3]},
  {arrayY[0],arrayY[1],arrayY[2],arrayY[3]}
};

The issue I had when searching the internet is the same as the link. "Surfed on the internet to find a bunch of examples but the only difference is that they don't use arrays that have been declared to have a name inside array."


texts: What is recommended color recognition sensor RGB for different cases?

texts:
What is recommended color recognition sensor in the following two cases:

To determine the color of the floor while the robot is moving (multi-color line follower).
To determine the color of an object in distance 10cm at least.

For both cases above, I am looking for a sensor so that I can get values like (R: 252 , G: 217 , B: 0) not only red, green or blue as an result, and no problem with small errors.


texts: How to set float to variable with 7 digits after the decimal point in arduino?


texts: Using Serial as boolean function argument

texts:
The following program compiles in the Arduino IDE.

void doSomething(bool) {}

void setup() {
  doSomething(Serial);
}

void loop() {}

But, as expected, this one doesn't:

class MyClass {};

void doSomething(bool) {}

void setup() {
  MyClass myClass;
  doSomething(myClass);
}

void loop() {}

The compiler returns the error cannot convert 'MyClass' to 'bool' for argument '1' to 'void doSomething(bool)'

Why is it possible to compile the former? Isn't Serial a normal class instance (of HardwareSerial)? Does it makes any sense to interpret Serial as a bool?


texts:
I am planing to build a project where an arduino pro mini 3.3V runs on 2 aa batteries. The standard brown out detection shuts it down at about 2.7/2.8V where it could run on lower voltages too.
So I changed the efuse to get the BOD down to 1.8V. I connected a serial to usb converter and used avrdude:

avrdude -c avrisp -p m328p -P COM5 -b 19200 -U lfuse:w:0xff:m -U hfuse:w:0xda:m -U efuse:w:0x06:m

Then I tried to upload a program using the arduino 1.0.3 IDE but I got this error:

avrdude: stk500_getsync(): not in sync: resp=0x1c

With 1.6.4 I got another error:

    avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x75
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1c

After some googling I tried some lower baud rate (the standard seems to be 57600). With 19200 everything worked with avrdude, so I created a new entry in the boards.txt

    ##############################################################

pro328.name=Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 BOD 1.8V

pro328.upload.protocol=arduino
pro328.upload.maximum_size=30720
pro328.upload.speed=19200

pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDA
pro328.bootloader.extended_fuses=0x06
pro328.bootloader.path=atmega
pro328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
pro328.build.variant=standard

And burned a bootloader using the 1.0.3 IDE again. After that I could upload a blink program. My goal is to upload a mysensors sketch though and that doesn't work. I am getting an error

avrdude: verification error, first mismatch at byte 0x0002
         0x69 != 0x61
avrdude: verification error; content mismatch

Mysensors seems to have general problems with old arduino IDEs so I tried to use the newer 1.6.4 but I can't define my own board there and if I try it without I get hte out of sync error (because it's still using the wrong baudrate I guess).

I also tried using another arduino uno as ISP => same results

How can I fix this? Is there a way to define my own board for 1.6.x?
Whats the standard way of doing this and why does the change of the efuse results in me not beeing able to program the mini any longer?

Thanks for every answer/help!


texts:
This is first time programming with Ethernet shield . I want to test the web server application with my Arduino. I have an Arduino Uno, Ethernet shield, and a potentiometer. Below code being uploaded.

Question are:

Currently I am using LAN connection to configure. How to configure it? Is internet required for below application?
How do I check the output?
Is there any software where i can make customized tags?
I have values coming from the serial port to be monitored on webserver. Can someone share how to monitor it?

Ethernet shield

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

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

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
      client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("
");
          }
          client.println("");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}


texts: How to change the baud rate of ESP8266 (12E) using an Arduino Uno?

texts: I have with me an Arduino UNO and an ESP8266 (12E) WiFi Module. I need to make a webserver using the two. I read that the default baud rate for ESP8266 is 115200, and that the software serial pins can't handle such high speeds. I dont have an USB-UART converter at hand. Is there a way to use my Arduino as one to change the baud rate, so that I can interface with the chip using the software serial pins of the Arduino later.


texts: I am experimenting the write((byte)num) function, and I stumble upon a pre-made custom character. Usually it's on above ((byte)200) or and below ((byte)10000). If anyone else know this, where could I find the list for a specific character?


texts:
I was wondering if its possible to program the esp8266 to receive firmware updates without the use of an IDE to program.

Use Case:
This device should be setup to the WiFi network scan an IP for a firmware update and update itself if needed.

Any help is greatly appreciated. Thank you


texts: Switching lights by Harry Potter themed voice commands

texts:
I'd like to know whether I can make the light in a room light up just by saying two voice commands. Specifically lumos and nox spells, like in Harry Potter. I have never worked with Arduino or with any programs it uses, but I have an idea how it should work. I watched some tutorials and read a bit about it, but I'm not entirely sure, if it will work and what exact types of Arduino components would be most suitable for it.

I'm thinking about connecting the voice command module's output directly to the light switch. But I don't know if it would be better if the Arduino would just somehow switch the light by enabling the current to flow or flipping the switch with a servomotor directly.

I also don't know if the module can work by itself when just plugged into the wall. If it has to be still plugged into a PC, that would be useless.

I'd also like to know which Arduino (or components in general) I should use and if the microphone could sense the commands from like 2-3 meters.

I really am thankful to anyone, who would be so kind and help me with this idea, because it should be a gift for my younger sister, probably the biggest Harry Potter fan in the world.


texts: Help to delimit and read specific contents of incoming HTTP string

texts:
I am sending strings to an Esp8266 via web browser.

The below code returns the following in serial monitor if I send in browser:

Send from browser to esp8266 - http://192.168.1.220/s1s2s3s4s5d1
Receive in Arduino Serial monitor - GET /s1s2s3s4s5d2 HTTP/1.1

How do i read only the contents s1s2s3s4s5d1  ? This content can vary in length, numbers could be double digits but alphabets will remain in between.

Please note I am still a novice.

// Read the first line of the request
String request = client.readStringUntil('\r');
Serial.println(request);
client.flush();


texts: Burning the Bootloader on Adafruit Feather 32u4

texts:
So, the default bootloader in Arduino is oddly set to erase EEPROM with every reboot, rendering the EEPROM, well, useless.

I found where the fuses are set in the boards.txt file, but getting this configuration change into the chip requires burning an updated booloader.

In the Arduino IDE, there is an option to "Burn Bootloader", but that would be way too easy, and of course, doesn't seem to work.

I can't find any clue on the Internet about how to actually get the bootloader updated in these devices.

So, is it possible to reprogram the bootloader on the Adafruit Feather 32u4 devices?

If so, what's the trick to do it?


texts: Arduino and Processing- Conditionals only executing sometimes in response to IR codes

texts:
I am reasonably new to arduino and even newer to Processing so still struggle with trouble shooting my code.

The intention of my sketch is have Processing receive IR codes from the arduino and execute different AppleScript applications accordingly.

It works sometimes! However I would really love it to work all the time :)

-The AppleScript apps definitely work and have been successfully launched

-The processing monitor has been printing the 'Val' variable consistently

The issue is that even though processing is reading from the serial port and assigning the IR codes printed there to the 'val' variable, it only sometimes executes the conditional

I added a delay to my arduino sketch to slow down how much data was entering the port and make it easier for Processing to read but it's inconsistent.

Any help would be greatly appreciated!

Arduino code:

#include <boarddefs.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600);
  Serial.print("Hello");
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(String(results.value,HEX));
     delay(100);
     irrecv.resume(); // Receive the next value
    }
}

Processing Code

import processing.serial.*;

Serial myPort;  // Create object from Serial class
String val;     // Data received from the serial port
String Down = "890";
String Up = "8188A2C8";
String CH1 = "E10";
void setup()
{
  // I know that the first port in the serial list on my mac
  // is Serial.list()[0].
  // On Windows machines, this generally opens COM1.
  // Open whatever port is the one you're using.
  String portName = Serial.list()[2]; //change the 0 to a 1 or 2 etc. to match your port
  myPort = new Serial(this, portName, 9600);
}

void draw()
{
  {
  if ( myPort.available() > 0)
  {  // If data is available,
  val = myPort.readString();         // read it and store it in val

   print(val);

    if(val.equals(Down) == true)
    {launch("/Applications/QlabDown.app");
  }
  if (val.equals(Up) == true) {
    launch("/Applications/QlabUp.app");
  }
  if (val.equals(CH1) == true) {
    launch("/Applications/CH1.app");
  }
}
}
}


texts: What USB to UART chip provides highest data rates with Arduino boards?

texts:
Checking out online stores for a USB/TTL adapter, I came across a wide range of products, and I'm having a hard time selecting the one which would achieve the highest data rate. I was comparing datasheets of the chips I have seen so far, to understand which baud rates are supported:

FT232R (FTDI): 183 to 3M baud, including 250k, 500k and 1M, 128 RX / 256 TX FIFO
PL2303 (Prolific): 75 to 1.2M baud, not including 250k, 500k and 1M, 256 RX / 256 TX FIFO
CP2102 (Silicon Labs): 300 to 921600 baud, including 250k and 500k, 576 RX / 640 TX FIFO
CH340G (WCH): 50 to 2M baud, not including 250k, 500k and 1M, unknown FIFO size

As explained here, 500k, 1M and 2M are particularly important, because those are the highest baud rates supported with 16MHz crystals. Moreover, data transmission becomes CPU-limited above 500k, so real data rates are practically the same with all three baud rates.

Am I right to assume that in order to get the highest data rate, I essentially have to stay away from PL2303, and prefer FT232R adapters, the other two chips being in the middle? Or are there other factors that I didn't take into account which may affect my choice?


texts: I have some issues with network and would like to work with arduino everywhere. I use Tinkercad which is great, but I would like to installit to my laptop and work without using WiFi. I couldn't find any "offline tinkercad" but maybe there are any similar programs where you can program AND write code inside.


texts: I bought a Ping Ultrasonic Range Finder. It has four pins that you connect to the Arduino. I see in Internet that they have three pins. What does represent each pin and where to connect it to? I have an Arduino Uno Starter Kit.


texts:
I made a part of code to change the temperature limit for alarm system. On warm days user have to change the temperature limit with buttons and OLED display.

The question is: How can the variable templimit keep its last setup value after many restarts(for many reasons)?

This is the code:

const int  buttonPin = 8;    // up
const int  buttonPin1 = 3;    // down
const int  buttonPin2 = 2;    // enter

int buttonPushCounter;   // counter for the number of button presses
int buttonState;;  // up
int buttonState1;;  // down
int buttonState2;;  // enter
int templimit; // temperature limit for alarm

void setup() {
  Serial.begin(9600);
  Serial.print("Update temperature limit if not wait 10 sec time out");
  updatevalue();
  Serial.print("Done");

}

void loop() {
// do nothing
}

int updatevalue(void) {
  int timenow;
  int timepassed;
  timenow = millis();
  // this loop is just for 10 sec time out
  while (buttonState == LOW and buttonState1 == LOW and buttonState2 == LOW) {
    buttonState2 = digitalRead(buttonPin2); // enter
    buttonState = digitalRead(buttonPin); //up
    buttonState1 = digitalRead(buttonPin1); // down
    timepassed = (millis() - timenow);
    if (timepassed >= 10000)
    return 0;
  }
  while (buttonState2 != HIGH) { // do this until enter is pressed

    buttonState2 = digitalRead(buttonPin2); // enter
    buttonState = digitalRead(buttonPin); //up
    buttonState1 = digitalRead(buttonPin1); // down

    if (buttonState == HIGH) { // up
      buttonPushCounter++;
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);
    }
    if (buttonState1 == HIGH) { // down
      buttonPushCounter-- ;
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);
    }
    delay(700);
  }
  templimit = buttonPushCounter; // update templimit value

}


texts: STM32f407G Discovery Board with keypad in arduino IDE

texts:
I am new to STM32F407G Discovery board. I am making a simple code for displaying whatever key is pressed on the 3*4 keypad onto the 16*2 LCD.

It continuously shows # on the screen, when nothing is being pressed. And in-between sometimes random digits.

These are the arduino settings:

Here is the code:

#include <LiquidCrystal.h>
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {PC5, PA7, PA5, PA3};
byte colPins[COLS] = {PA1, PC3, PC1};

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
LiquidCrystal lcd(PE9, PE10, PE11, PB1, PB0, PE7, PE8);

void setup(){
  lcd.begin(16, 2);
  lcd.clear();
}

void loop(){
  char key = keypad.getKey();

  if (key){
    lcd.print(key);
  }
}


texts: Can the Arduino interface with USB devices without the USB host shield?

texts:
I'm looking to connect various USB-devices to an Arduino Uno (specifically, a gamepad and a webcam, but I'm interested in the general case). Is this possible without using the USB host shield, since the Uno has a USB port and USB-to-serial converter? I could use the shield, but I'm curious if/why it's neccessary.

The Sparkfun website states that:

  The SparkFun USB Host Shield contains all of the digital logic and analog circuitry necessary to implement a full-speed USB peripheral/host controller with your Arduino.

Does the Arduino not already contain this, just needing the proper software (although obviously it's easier to use the already written library for the Host Shield). Or are there hardware limitations?

According to
Can a Ethernet USB Dongle be instead of ethernet shield for arduino?
(Majenko's answer), it can, in theory, be done with the Due, but not with the Uno. In that case, is this because the Uno uses the ATmega16U2 instead of the FTDI FT232RL for USB communication?


texts: Why is my potentiometer giving strange reading?

texts:
I have a 10kOhm linear Potentiometer. I connected it to analog 0, as in https://www.arduino.cc/en/Tutorial/Potentiometer.

The analogRead() gives a value between 0 and 1023, so I was expecting 0 if the potentiometer is at the lowest position, 1023 if it is at the highest position and 500 somewhere in the middle.

In fact I get ~40 at the lowest position, I get 1021 at the highest position (that's okay, I guess), and I also get 1021 at the middle. 500 is at a 1/4 position, I expected to have ~255 there.

I measured the resistance of the potentiometer. It reads ~200 Ohm at the lowest postion, 10kOhm (as expected) at the highest position and ~5kOhm in the middle, so, exactly as I expected.

So, what did I get wrong?


texts: Making two points on a tm1637 display blink [ Solved ]

texts:
Hello! In my project, using a display controlled by a TM1637, I want to make the two points on the middle of the screen blink (as every clock does).
The following example, provided by the library I'm using, makes the two points blink as I want (tm1637.point(POINT_ON/POINT_OFF); is what enables/disbales the point):
#include <TimerOne.h>
#include "TM1637.h"
#define ON 1
#define OFF 0

int8_t TimeDisp[] = {0x00,0x00,0x00,0x00};
unsigned char ClockPoint = 1;
unsigned char Update;
unsigned char halfsecond = 0;
unsigned char second;
unsigned char minute = 0;
unsigned char hour = 12;

#define CLK 2//pins definitions for TM1637 and can be changed to other ports
#define DIO 3
TM1637 tm1637(CLK,DIO);

void setup()
{
  tm1637.set();
  tm1637.init();
  Timer1.initialize(500000);//timing for 500ms
  Timer1.attachInterrupt(TimingISR);//declare the interrupt serve routine:TimingISR
}
void loop()
{
  if(Update == ON)
  {
    TimeUpdate();
    tm1637.display(TimeDisp);
  }

}
void TimingISR()
{
  halfsecond ++;
  Update = ON;
  if(halfsecond == 2){
    second ++;
    if(second == 60)
    {
      minute ++;
      if(minute == 60)
      {
        hour ++;
        if(hour == 24)hour = 0;
        minute = 0;
      }
      second = 0;
    }
    halfsecond = 0;
  }
 // Serial.println(second);
  ClockPoint = (~ClockPoint) & 0x01;
}
void TimeUpdate(void)
{
  if(ClockPoint)tm1637.point(POINT_ON);
  else tm1637.point(POINT_OFF);
  TimeDisp[0] = hour / 10;
  TimeDisp[1] = hour % 10;
  TimeDisp[2] = minute / 10;
  TimeDisp[3] = minute % 10;
  Update = OFF;
}

I tried to do it as it was the famous "blink", but nothing works.
Here's what I have done:
#include "TM1637.h" // Library for the 4-Digit Display
#include "RTClib.h" // Library for the RTC
#include <SoftwareSerial.h>

#define CLK 6
#define DIO 7

TM1637 tm1637(CLK,DIO);
RTC_DS1307 RTC;

const int fotoRes = 2;

SoftwareSerial mySerial(10, 11);

void setup()
{
  pinMode(fotoRes, INPUT);

  RTC.begin();
  RTC.adjust(DateTime(__DATE__, __TIME__));

  tm1637.init();
}
void loop()
{
  DateTime now = RTC.now();

  tm1637.display(0,now.hour()/10);
  tm1637.display(1,now.hour()%10);
  tm1637.display(2,now.minute()/10);
  tm1637.display(3,now.minute()%10);

  tm1637.point(POINT_ON); //Like blink example.
  delay(500);
  tm1637.point(POINT_OFF);
  delay(500);
}

EDIT: tm1637.set(0-7) ONLY set the brightnes of the screen. What makes the two pints appear is tm1637.point(POINT_OFF/POINT_ON). I'm asking how can I do to make these two points blink. Thanks.
Arduino UNO R3, DigitalTube library by Grove


texts: How can i receive data from Mega2560 on PC with Visual C#

texts:
How can i receive the data from my Arduino Mega 2560 with Visual C# on my PC.

I send a short databyte (2 bytes) and a timestamp (4 bytes) over USB to PC

//initialization

const int RX = 0;
const int TX = 1;

void setup(){

pinMode(RX, INPUT);   //readpin for USB
pinMode(TX, OUTPUT);  //writepin for USB
...

Serial.begin(28800);   //open interface
}

 //loop()

 Serial.print(incomingByte, BIN); //sending databyte

 sendBinary(currentMillis);   //send timestamp

//method for timestamp

void sendBinary(long currnetMillis)
 {
  int temp = currentMillis&0xFFFF;  //16 bit of the low-byte
  sendBinary(temp);
  temp = currentMillis >> 16;       //16 bit of the high-byte
  sendBinary(temp);
 }

I have surched in the internet for an example but i didn´t find a good. So i ask here what ist the best way with Visual Studio C# to receive the incoming data?
An example code will be nice because i´m a beginner and didn´t understand the jargon.

With frindly wishes sniffi


texts: Non intrusive current sensor with unreliable (strange) readings

texts:
I have a project where I will mount 6 non intrusive current sensor model SCT013 (100A/50mA) manufactured by yhdc.com on an Arduino Mega.

Virtual ground and Burden resistors are 1% tolerance.

To start testing I mounted 2 sensors using the principles of connection found at (http://www.homautomation.org/2013/09/17/current-monitoring-with-non-invasive-sensor-and-arduino/). Code below.

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon0;                   // Create an instance
EnergyMonitor emon1;                   // Create an instance

int Calib = 60;

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

  emon0.current(A0, Calib);             // Current: input pin, calibration.
  emon1.current(A1, Calib);             // Current: input pin, calibration.

   }

   void loop(){

double Irms0 = emon0.calcIrms(1480);
double Irms1 = emon1.calcIrms(1480);

Serial.print("Sensor0: ");
Serial.print(Irms0);
Serial.print(" Amps ");

Serial.print("Sensor1: ");
Serial.print(Irms1);
Serial.println(" Amps ");

}
//------------end------------

The code I found is for UNO and a single sensor and I just added a second, it works fine and sensors do independent readings well.

Both sensors are mounted on the same test live wire so I have to get more or less the same readings most of the times and it is precisely the case with readings floating between sensors on the order of 100s of miliamps.

My problems are:

Even with no load I get, on both sensors, a reading that varies from 270 to 320mA
When I connect a hair dryer that consumes in one mode 10A and in
another mode 5A the readings are a lot closer to the expected (I am
also checking with a clamp meter)

The problem seems to be the no load condition and the imprecise readings at low currents.
I could exclude readings under a certain value on my code to solve the no load problem but them I would be ignoring real electrical measurement situations.


texts: Can I use only Ruby or Crystal Lang with an Arduino?

texts:
I am new to Arduino. I have used other SBCs before and ran some ruby script to automate many tasks.

I know Ruby and Crystal programming languages.

Can I use Ruby or Crystal solely on Arduino for creating basic robot?


texts: How to connect an lcd i2c using only pins A0 and A1 (SDA, SCL, GND, and VCC are given)

texts:
I want to know how to connect an lcd i2c, with an led 8x8 matrix at the same time. The problem is, all the analog in pins are used, except A0 and A1. Using this tutorial:
https://www.makerguides.com/character-i2c-lcd-arduino-tutorial/
It says I must have analog pins A0-A2 with nothing connecting, except I have A2 connected, which is why both screens don't work right. So how can I use only pins A0-A1 with an lcd i2c? Thanks.


texts:
I'm trying to find the I2C address of an IMU plugged into my Arduino using the code from this URL: http://playground.arduino.cc/Main/I2cScanner.  However, the program stalls at this stage:

Why could this be happening?


texts: How to know if arduino activated its short breaker?

texts:
today i was trying to use arduino power headers as a power source for my basic laser.
I used pin "5V" to connect it to the laser anode and the "GND" pin to the laser groung pin.
after doing this arduino turned restarted, so I removed all the connections to the laser, now the arduino is normal.
booth "5V" and "GND" pins is working normal.
does this mean that I made a short circut and arduino protected it self ?
should I do anything now ?


texts: max7219 chained display showing text only on the first display

texts:
I'm using a max7219 like this one max7219. When I first tested my circuit, I used an 8x8 display and the code worked just fine. Now, after I modified the code and changed the display with the chained one, the text is showing only on the first matrix. I've seen someone that had another problem with the same matrix module, only that in his case the same text was printed on all the matrixes unsolved problem, in the end he didn't find a solution. Below, I'll attach my code. Please help me find the problem.

//Pin connected to ST_CP of 74HC595
int latchPin = 6;
//Pin connected to SH_CP of 74HC595
int clockPin = 7;
////Pin connected to DS of 74HC595
int dataPin = 5;

int period = 30;

byte rotl(byte n, byte b)
{
  return (n << b) | (n >> (8 - b));
}

byte X[] {

0x80,
0x80,
0x80,   //L
0x80,
0x80,
0x80,
0x80,
0xFF,

/*0x10,
0x00,
0x10, //I
0x10,
0x10,
0x10,
0x10,
0x10,

0XF0,
0x90,
0x80, //C
0x80,
0x80,
0x80,
0x90,
0xF0,

0xF0,
0x09,
0x09,
0x09,
0x09,
0x09, //A
0x09,
0xF0*/

};

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop()
{
  for (int i = 0; i < 8; i++)
  {
    X[i] = rotl(X[i], 1);
  }
  for(int i = period;i>0;i--)
  {
    displayX();
  }

}

void DisplayMatrix(byte numCol, byte numLine)
{
  byte numberToDisplay1 = numCol;
  byte numberToDisplay2 = numLine;

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay1);
  shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay2);
  digitalWrite(latchPin, HIGH);
  delay(1);

}

void displayX()
{
   DisplayMatrix(X[0],1);
   DisplayMatrix(X[1],2);
   DisplayMatrix(X[2],4);
   DisplayMatrix(X[3],8);
   DisplayMatrix(X[4],16);
   DisplayMatrix(X[5],32);
   DisplayMatrix(X[6],64);
   DisplayMatrix(X[7],128);
}


texts: How to solve problem AT+INQ ERROR (1F), AT+INIT ERROR(17) on Bluetooth Module HC-05?

texts:
i have problem with accessing at-command in module Bluetooh HC-05.

i just follow all tutorial to activate at-command like this,
http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-in-slave-mode/

or in this video
https://www.youtube.com/watch?v=Vr4cdpsoVEo&t=31s

and just read some explanation and implemented to my problem
HC-05 Bluetooth AT+INQ command not working

but i just still get same error.
i cant use AT+INQ command, always get ERROR(1F).
AT+INIT get ERROR(17).

i have module HC-05 with version 3.0-20170601

This is my code i use it.

#include <SoftwareSerial.h>
SoftwareSerial BTserial(8, 9); // RX | TX`

const long baudRate = 38400;
char c=' ';
boolean NL = true;

void setup()

{
   Serial.begin(9600);
   Serial.print("Sketch:   ");   Serial.println(__FILE__);
   Serial.print("Uploaded: ");   Serial.println(__DATE__);
   Serial.println(" ");

BTserial.begin(baudRate);
Serial.print("BTserial started at "); Serial.println(baudRate);
Serial.println(" ");
}

void loop()

{

// Read from the Bluetooth module and send to the Arduino Serial Monitor
if (BTserial.available())
   {
       c = BTserial.read();
       Serial.write(c);
   }

   // Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
   {
       c = Serial.read();
       BTserial.write(c);

    // Echo the user input to the main window. The ">" character indicates
    the user entered text.
    if (NL) { Serial.print(">");  NL = false; }
    Serial.write(c);
    if (c==10) { NL = true; }
   }

}


texts: Serial monitor when port is being used by another application

texts:
I am controlling some LEDs via the USB serial port using a Tkinter/Python3x script to debug what I suspect is a hardware problem.

from tkinter import *
import serial

usbport = 'COM3'
ser = serial.Serial(usbport, 9600, timeout=1)

def init():
    print("Started")

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()
        self.scale1 = Scale(master, from_=0, to=255, command=lambda ev: self.getBright(1), bd=5, bigincrement=2, length=360, width=30, label='RED')
        self.scale1.set(128)
        self.scale1.pack(side=LEFT)
        self.scale2 = Scale(master, from_=0, to=255, command=lambda ev: self.getBright(2), bd=5, bigincrement=2, length=360, width=30, label='GREEN')
        self.scale2.set(128)
        self.scale2.pack(side=LEFT)
        self.scale3 = Scale(master, from_=0, to=255, command=lambda ev: self.getBright(3), bd=5, bigincrement=2, length=360, width=30, label='BLUE')
        self.scale3.set(128)
        self.scale3.pack(side=LEFT)
        self.centre = Button(frame, text="Centre All", command=self.centre)
        self.centre.pack(side=TOP)

    def getBright(self, slider):

        if slider==1:
            brt = self.scale1.get()

        if slider==2:
            brt = self.scale2.get()

        if slider==3:
            brt = self.scale3.get()

        ser.write(255)
        ser.write(slider)
        ser.write(brt)

    def centre(self):

        for LED in range(0, 4):

            ser.write(255)
            ser.write(LED)
            ser.write(128)

        self.scale1.set(128)
        self.scale2.set(128)
        self.scale3.set(128)

init()
root = Tk()
app = App(root)
root.mainloop()

On the Arduino Mega 2560 side I read in from serial a start byte, LED label & a brightness value...

int user_input[3];
int start_byte;
int LED;           // which LED to pulse? r=1 g=2 b=3
int brightness;
int i;

// LED pins
#define REDPIN 7
#define GREENPIN 8
#define BLUEPIN 9

void setup()
{

  // LED outputs
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);

  Serial.begin(9600);
}

void loop()
{
  if (Serial.available() > 2) {

    start_byte = Serial.read();
    if (start_byte == 255) {

      for (i = 0; i < 2 ; i++) {
        user_input[i] = Serial.read();
      }

      LED = userInput[0];
      brightness = user_input[1];

      switch (LED) {

        case 1:
          analogWrite(REDPIN, brightness);
          break;

        case 2:
          analogWrite(GREENPIN, brightness);
          break;

        case 3:
          analogWrite(BLUEPIN, brightness);
          break;

      }
    }
  }
}

Now I would like to see what is actually being sent via the serial port to the Arduino using the serial monitor (yes I know I can just print the values in the Python terminal that's not what I'm asking).

The problem is that the Arduino Serial Monitor is locked out. I'm guessing this is a Windows thing (Win10 x64)? Has anybody here come across this?


texts: I have an Arduino Nano 33 IoT and have used it for a good time now. I was using it when the antenna snapped off. Is there any way to fix it by either an external antenna or some other method? I tried to just hold the antenna in place as I tried to connect to wifi but it failed to connect.


texts: How to upload .hex file to Atmega8 Using Arduino IDE and Uno as an Isp?

texts:
I want to upload an .hex file to an Atmega8 chip (SMD). I want to use the Arduino IDE and an Uno as the ISP program. But I'm unable to find any details on how to load a sketch which is in .hex format.

Following is the batch file I created to use with avrdude. I would like to know if the Command is correct?

C:\Users\Pranay\Desktop\DIY\arduino-1.0.1!\hardware\tools\avr\bin/avrdude -CC:\Users\Pranay\Desktop\DIY\arduino-1.0.1!\hardware\tools\avr\etc/avrdude.conf -v -v -v -v -patmega8 -cstk500
 -P\\.\COM4 -b19200 -Uflash:w:C:\Users\Pranay\Desktop\DIY\arduino-1.0.1!\hexFiles\Heart.hex:i

pause


texts: GET command with GPRS GSM A6 and arduino

texts:
I'm trying to get data from a text file(read.txt) in server by sending a HTTP GET request via AT commands for the GPRS GSM. Here is my code:

void setup()
{
     Serial.begin(115200);
     delay(500);

     Serial.println("AT+CIPSHUT");
     delay(1000);
     printSerialData();

     Serial.println("AT+CIPMUX=0");
     delay(1000);
     printSerialData();

     Serial.println("AT+CGATT=1");
     delay(1000);
     printSerialData();

     Serial.println("AT+CSTT=\"internet\",\"\",\"\"");
     delay(1000);
     printSerialData();

     Serial.println("AT+CIICR");
     delay(1000);
     printSerialData();

     Serial.println("AT+CIFSR");
     delay(1000);
     printSerialData();

     Serial.println("AT+CIPSTART=\"TCP\",\"xxx.xxx.xxx.xxx\", 80");
     delay(1000);
     printSerialData();

     Serial.println("AT+CIPSEND");
     delay(1000);
     printSerialData();

     Serial.println("GET http://xxx.xxx.xxx.xxx/data/read.txt HTTP/1.1");
     delay(1000);
     printSerialData();

     Serial.println("Host: xxx.xxx.xxx.xxx\r\n");
     delay(1000);
     printSerialData();

     Serial.write(0x1A);
     delay(10000);
     printSerialData();
}

Here's the serial monitor's output.

AT+CIPSHUT

+CME ERROR:50
AT+CIPMUX=0

OK
AT+CGATT=1

OK
AT+CIPMUX=0

OK
AT+CGATT=1

OK
AT+CSTT="internet","",""

OK
AT+CIICR

OK
AT+CIFSR

10.114.139.110

OK
AT+CIPSTART="TCP","xxx.xxx.xxx.xxx", 80

CONNECT OK

OK
AT+CIPSEND

> GET http://xxx.xxx.xxx.xxx/data/read.txt HTTP/1.1
Host: xxx.xxx.xxx.xxx

OK

+CIPRCV:241,HTTP/1.1 200 OK
Date: Tue, 13 Feb 2018 13
OK

So, after date is shown, I get nothing. The data in text file is not printed.
Why is that?

I want the data in text file to be printed here.


texts:
I saw this project with multiple servos: In Servo We Trust! Let's control 135 servos with a single Arduino! I wanted to miniaturize this project.

BUT instead of triangles i will use SQUARES.

:EDIT: summing UP

For now project stops, not forever. I bought 9 servos on aliexpress and im waiting for them to be delivered. Also, im making a 3D project in AutoDesk Maya 2018, planning and will sbow you the results soon how im gonna make it work.
I was thinking about adding 1 more servo and hc sr06 distance sensor. I was thinking about the sensor will detect person, servos and mirrors will also follow the person. But idk if im gonna make it to the final project.

I bought arduino nano that will be powered from the battery
All servos will be powered with electricity from the wall 5V 5A.The servos wont be on heavy load so it will be enough i think.If any problem occurs I will use 10A.

ALSO SORRY for not editing this POST earlier.

I would like to thank everybody for giving me such a great advices, I will post my AutoDesk project soon.


texts:
I am using atmega 328pu instead of atmega328p-pu. I am trying to upload the bootloader using AVR pocket programmer.

I have changed signature from 0x1e 0×95 0x0F to 0x1e 0×95 0×14.

(Relevant link)

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


texts: How to use correctly a microstepping driver with a lower voltage stepper motor

texts:
I want to use a microstepping driver like Haitronic's HS2215 with a NEMA 17 stepper motor with rated voltage of 4.2V and rated current 1.5A.
The input voltage range of the microstepping driver is 9-40VDC.
From what I understand,  I can use the switches to set the maximum current. In this particular case I would use SW4=On, SW5=On, SW6=Off.

TB6600 current settings
You can adjust the current that goes to the motor when it is running by setting the dip switches S4, S5, and S6 on or off.

I've found this Maker's Guide which describes the settings for use with an arduino.
However, I am not certain what voltage (VCC) should I supply to the mircrostepping driver? Should I provide, the minimum of 9VDC, should I provide less? Is this irrelevant?


texts:
I'm checking an example for the MPU6050 and got to this part

Wire.beginTransmission(0x68);           //begin, Send the slave adress (in this case 68)
Wire.write(0x1B);                       //We want to write to the GYRO_CONFIG register (1B hex)
Wire.write(0x10);                       //Set the register bits as 00010000 (1000dps full scale)
Wire.endTransmission(true);             //End the transmission with the gyro

Serial.begin(9600);                     //Remember to set this same baud rate to the serial monitor
time = millis();                        //Start counting time in milliseconds

/*Here we calculate the gyro data error before we start the loop
 * I make the mean of 200 values, that should be enough*/
if(gyro_error==0)
{
  for(int i=0; i<200; i++)
  {
    Wire.beginTransmission(0x68);            //begin, Send the slave adress (in this case 68)
    Wire.write(0x43);                        //First adress of the Gyro data
    Wire.endTransmission(false);
    Wire.requestFrom(0x68,4,true);           //We ask for just 4 registers

Why is there two consecutive wire.write() in the begining and only one later? Is it different somehow?


texts: I'm using esp12e for my project and encountered difficulty in using more than 5 GPIOs. I have connected GPIO15 to Ground, GPIO0 to VCC, Enable to VCC (Connections as as per attached image). I'm able to use only GPIO4,5,12,13 & 14 as IOs. How can I use others too as IOs?


texts:
I have the following code for Arduino mega to output 40 kHz square waves at the analog pins. I need to apply specific phase delays for the signals at each pin though and am struggling to find out how to do this. Any help would be appreciated.
Thanks!

byte TP = 0b10101010; // Every other port receives the inverted signal

void setup() {

DDRF = 0b11111111; // Set all analog ports to be outputs
DDRK = 0b11111111; // Set all analog ports to be outputs
// Initialize Timer1

noInterrupts(); // Disable interrupts

TCCR1A = 0;

TCCR1B = 0;

TCNT1 = 0;

OCR1A = 200; // Set compare register (16MHz / 200 = 80kHz square wave -> 40kHz full wave)

TCCR1B |= (1 << WGM12); // CTC mode

TCCR1B |= (1 << CS10); // Set prescaler to 1 ==> no prescaling

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

interrupts(); // Enable interrupts

}

ISR(TIMER1_COMPA_vect) {

PORTF = TP; // Send the value of TP to the outputs
PORTK = TP;
TP = ~TP; // Invert TP for the next run

}

void loop() {

// Nothing left to do here :)

}


texts: Which Barcode Scanner to be used with arduino in India

texts:
I know this question is not so releavant as it does not include any research, but I am in search of a barcode scanner that i can easily interface with arduino and get output from it but unfortunately the Scanner models which are listed from the people doing the same stuff are not easily available in India. So if anyone knows which barcode scanner would best suit the requirement please suggest.
Availabilty in Indian market would be much appreciated :)


texts: i need to connect ultrasonic gas MQ2 and IR sensor(as blink counter) to count the number of blinks

texts:
im making a drowsiness detection using IR sensor as blink counter less than 30 and ultrasonic sensor distance should be less than 50cm and gas sensor MQ2 if the driver has consumed alcohol the gas will be detected and buzzer will be turned on and if the driver is drowsy the arduino will count the blinks if less than 30 it will turn on the buzzer and display on LCD as drowsy driver and led will blink.
can anyone pls help me with the codes?

i have managed the code

int trigPin = 6;
int echoPin = 7;
int IRSensor = 2; //connect ir sensor to arduino pin 2
int LED = 13;
int LED1 = 12;
int buzzer = 10;
int smokeA0 = A5;
int sensorThreshold = 50;
int sound=250;

void setup() {
  pinMode(trigPin,OUTPUT);
  pinMode(echoPin,INPUT);
  pinMode( IRSensor,INPUT);//sensor pin INPUT
  pinMode(LED1,OUTPUT);
  pinMode(LED, OUTPUT);//LED pin OUTPUT
  pinMode(buzzer, OUTPUT);//Buzzer Pin OUTPUT
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
}

void loop()
{
  long duration,distance,statusSensor;

  int IRSensor = digitalRead(IRSensor);
  int analogSensor = analogRead(smokeA0);
  Serial.print("Pin 2");
  Serial.println(statusSensor);
  Serial.print("Pin A0: ");
  Serial.println(analogSensor);
  // Checks if it has reached the threshold value
  if (distance<=30)
  if (statusSensor == 10)
  if (analogSensor > sensorThreshold)
  {
    digitalWrite(LED, HIGH);
    digitalWrite(LED1, LOW);
    tone(buzzer, 1000, 200);
  }

  else
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED1, HIGH);
    noTone(buzzer);
  }
  digitalWrite(LED, HIGH);
    digitalWrite(LED1, LOW);
    tone(buzzer, 1000, 200);
  }

  else
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED1, HIGH);
    noTone(buzzer);
  }
  else
  {
    digitalWrite(LED, HIGH);
    digitalWrite(LED1, LOW);
    tone(buzzer, 1000, 200);
  }

 else
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED1, HIGH);
    noTone(buzzer);
  }
  delay(100);
}


texts:
I am trying to set up several ATSAM-based AVR chips in a master/slave broadcasting arrangement. I want the master to be able to send a broadcast message to I2C address 0, and then for slaves to respond with different information. I have seen other implementations where this has been successful since I2C devices will typically self-arbitrate and if they are configured to back-off when arbitration is lost, the master can repeat its request and iterate over all addresses on the bus.

The challenge is that while I have Wire.beginTransmission(0) working to reach my slaves from the master, I cannot get Wire.requestFrom(0,6) to work. The slave acts as though no message had arrived in the reply case. This is in the reduced case of one master and one slave.

In the example below, changing RequestFrom to the slave address will work.

I am aware that on the SAMD architecture, ArduinoCore does not configure the SERCOM for I2C broadcasts so I made a one-line modification as follows to enable it:

sercom->I2CS.ADDR.reg = SERCOM_I2CS_ADDR_ADDR( ucAddress & 0x7Ful ) | // 0x7F, select only 7 bits
                      SERCOM_I2CS_ADDR_ADDRMASK( 0x00ul ) |
                      SERCOM_I2CS_ADDR_GENCEN // added by JAG

My master code:

#include <Wire.h>

void setup() {

  Serial.begin(9600);
  Serial.println("Sketch start" );

  Wire.begin(); // join i2c bus (address optional for master)
}

byte x = 0;

void loop() {

  Serial.print("-- Top of loop:" );
  Serial.println( millis() );

  Wire.beginTransmission(0); // transmit to device #8
  Wire.write("x is ");        // sends five bytes
  Wire.write(x);              // sends one byte
  Wire.endTransmission(true);    // stop transmitting

  // delay( 500 );

  uint8_t recvSize = Wire.requestFrom(0, 6);    // request 6 bytes from slave device #8

  Serial.print( "Got bytes: " );
  Serial.print( recvSize );
  Serial.print( "---> ");

  while (Wire.available()) { // slave may send less than requested
    char c = Wire.read(); // receive a byte as character
    Serial.print( "[") ;
    Serial.print(c);         // print the character
    Serial.print( "]" );
  }
  Serial.println();

  x++;
  delay(500);
}

My slave code:

#include <Wire.h>

void setup() {
  Wire.begin(9);                // join i2c bus with address #8
  Wire.onReceive(receiveEvent); // register event
  Wire.onRequest(requestEvent); // register event
  Serial.begin(9600);           // start serial for output
  Serial.println( "Starting up" );
}

void loop() {
  delay(500);
    Serial.print( "In top of loop (slave): " );
    Serial.println(millis() );
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany) {
  while (1 < Wire.available()) { // loop through all but the last
    char c = Wire.read(); // receive byte as a character
    SerialUSB.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  SerialUSB.println(x);         // print the integer
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
  Wire.write("hello"); // respond with message of 6 bytes
  // as expected by master
  Serial.println( "<<<< Writing a response." );
}


texts:
For my college course we currently have to carry out a project of our own choice.
I chose to make a Tail light system, with strobing indicators, fog-light and brake-light.

The lighting uses Neopixel strips and rings, with the indicator sections consisting of 2 neopixel strip 6 (in parallel); the fog light using a neopixel jewel; and the brake light using a neopixel ring 16.

The indicators need to strobe outward from the centre of the device (in the desired direction, left/right) based on a button input. The fog-light should turn on when the device is activated by switch, and the brake-light will turn on when receiving an input from another button.

I've only ever coded using Python during GCSE and can't wrap my head around Arduino code. Currently using tinkercad for creating this as I don't have any arduino kit, and don't want to spend out the money on unneeded components.

Any help is appreciated, and if a link to the tinkercad circuit would be useful let me know.


texts: How to connect a card reader (extracted from printer) to arduino uno

texts:
I'v got this USB/SD card/CompactFlash reader from an old DELL AIO 926 printer, it's a double sided PCB board and that's all i know about it.
I tried to google it but couldn't find anything relevent, how can i tell what voltage it takes and what each wire does and how to interface it with arduino?

It seems to me that it has two sets of 4 wires (red/orange - black - yellow - white) and an extra blue wire, i'm guessing that the black is for GND, red/orange for VCC, yellow/white for SDA/XDA I2C serial bus data transfer, but no clue what the blue wire does, i could've tested this with arduino but i don't want to risk frying the board by using a wrong voltage. any help would be greately appreciated. thanks.


texts: Can anybody advise what type of connector this is?

texts:
I recently purchased an LiPower shield from SparkFun.

I also bought a Lithium Polymer battery off eBay and it appears to have a JST male connector (i could be wrong)?

I expected it to slot right into the board however the fit is slightly too large. Can any advise me of the name of the connector for the board battery supply, or have I mistaken the battery output connector?

Please see pictures below, thanks!


texts:
I'm working on a project in which when I press reset button the arduino should send longitudes and latitudes to my phone. I'm a beginner and tried to join two codes, first code can send the message and the second code can get the lon and lat printed on the serial monitor.

First code--

int timesTosend=1;
int count=0;
char phone_no[]="+917771914436";
void setup()
{
  Serial.begin(9600);
  delay(2000);
  Serial.println("AT+CMGF=1");
  delay(200);
}
void loop()
{
  while (count<timesTosend)
  {
    delay(1500);
    Serial.print("AT+CMGS=\"");
    Serial.print(phone_no);
    Serial.println("\"");
    while(Serial.read()!='>');
    {
      Serial.print("Hii If this message is sent then its a huge sucess for me");
      delay(500);
      Serial.write(0x1A);
      Serial.write(0x0D);
      Serial.write(0x0A);
      delay(5000);
    }
    count++;
  }
}

Second code--

#include <SoftwareSerial.h>
#include <TinyGPS.h>

long lat,lon; // create variable for latitude and longitude object

SoftwareSerial gpsSerial(4, 3); // create gps sensor connection
TinyGPS gps; // create gps object

void setup(){
  Serial.begin(9600); // connect serial
  gpsSerial.begin(9600); // connect gps sensor
}

void loop(){
  while(gpsSerial.available()){ // check for gps data
   if(gps.encode(gpsSerial.read())){ // encode gps data
    gps.get_position(&lat,&lon); // get latitude and longitude
    // display position
    Serial.print("Position: ");
    Serial.print("lat: ");Serial.print(lat);Serial.print(" ");// print latitude
    Serial.print("lon: ");Serial.println(lon); // print longitude
   }
  }
}

My code which is not working--

#include <SoftwareSerial.h>
#include <TinyGPS.h>
long lat,lon; // create variable for latitude and longitude object

SoftwareSerial gpsSerial(4, 3); // create gps sensor connection
TinyGPS gps; // create gps object

void setup()
{
  Serial.begin(9600); // connect serial
  gpsSerial.begin(9600); // connect gps sensor
    Serial.begin(9600);
  delay(2000);
  Serial.println("AT+CMGF=1");
  delay(200);
}

int timesTosend=1;
int count=0;
char phone_no[]="+917771914436";
void loop()
{
  while (count<timesTosend)
  {
    delay(1500);
    Serial.print("AT+CMGS=\"");
    Serial.print(phone_no);
    Serial.println("\"");
     while(Serial.read()!='>');
    {
      while(gpsSerial.available())
      {
        if(gps.encode(gpsSerial.read()))
        { // encode gps data
    gps.get_position(&lat,&lon); // get latitude and longitude
    Serial.print(lat,lon);
      delay(500);
      Serial.write(0x1A);
      Serial.write(0x0D);
      Serial.write(0x0A);
      delay(5000);
        }
      }
    }
    count++;
  }
}

Please help me out by correcting my mistake in the code.


texts: Why when I pull an EEPROM index the value returned is garbage?

texts:
I have an array of colors for my tft screen:

const uint16_t colorTheme [] PROGMEM = {BLACK, WHITE, NAVY, CYAN, RED, GREEN, VERDEAQ, PINK, ORANGE, PURPLE, GRAY, YELLOW};

When I try to use colorTheme [EEPROM.read (2500)] I am returned with a value of any garbage, or a value of 0, and I checked it in read_eeprom and the value of EEPROM.read (2500) is equal to 4, and 4 in mine vector is cyan color, not black or 0 number, why does this go so wrong?


texts:
I just bought a DS18B20 temperature sensor. I can't detect the device when i run this code :

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 10 on the Arduino
#define ONE_WIRE_BUS 10

// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
 }

 void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
 // request to all devices on the bus
  Serial.print(" Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");

  Serial.print("Temperature for Device 1 is: ");
  Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
    // You can have more than one IC on the same bus.
    // 0 refers to the first IC on the wire

}

Here are my connections:

and output on Serial Terminal is:

      "Temperature for Device 1 is: -127.00 Requesting temperatures...DONE"

I also tried to detect the address of my device but with no success.
I am using an arduino Mega 2560, i have read in some forms that maybe it has something to do with Clock speed or something like that.

I appreciate your help.

I mainly followed this tutorial : http://www.hobbytronics.co.uk/ds18b20-arduino


texts:
Hi I am making a sketch and circuit with a HC-05 BT receiver to upload sketches via Bluetooth to my Uno.  This requires giving AT commands from the sketch.  I would like to see the response from the HC-05 but so far I haven't got it to work.  I want to view the response via the standard serial connection and serial monitor.  The commands from the sketch are not being recognized by the HC-05 and I would like to see the HC-05 response to troubleshoot it.

If you have a minute would you mind giving me a tip?  I would greatly appreciate it.  See the ArdProgramModeOn() and Off functions at the end.

Thanks

int ATModePin = 2;  // pin for HC-05 AT comand mode
int HC05powerPin = 3;  // pin for powering HC-05 when high
char btserialrx;  // data through from bt connection
char myChar; // data through serial port connection
#define rxPin 8 // HC-05 bt serial pin
#define txPin 9 // HC-05 bt serial pin

#include <SoftwareSerial.h>
SoftwareSerial btSerial(rxPin, txPin); // RX, TX

void setup() {
  pinMode(ATModePin, OUTPUT);
  pinMode(HC05powerPin, OUTPUT);
  pinMode(5, OUTPUT);
  Serial.begin(9600);
  btSerial.begin(115200);

  digitalWrite(HC05powerPin, HIGH);
  delay(2000);
  }

void loop() {

  while (btSerial.available()) {
    btserialrx = btSerial.read();
  }

  if(btserialrx == '1'){  // change to upload / reset mode
    Serial.println("switching to upload mode");
    ATModeOn();
    ArdProgramModeOn();
    ATModeOff();
    btserialrx = '0';
  }
  else if (btserialrx == '2'){  // change to normal mode
    Serial.println("switching to normal mode");
    ATModeOn();
    ArdProgramModeOn();
    ATModeOff();
    btserialrx = '0';
  }
}

void ATModeOn(){  // reset HC-05 and change HC-05 to AT Command Mode
  digitalWrite(5, HIGH);
  digitalWrite(ATModePin, HIGH); // AT command mode on upon reset
  delay(2000);
  digitalWrite(HC05powerPin, LOW); // hc-05 off
  delay(2000);
  digitalWrite(HC05powerPin, HIGH); // hc-05 on
  delay(2000);
}

void ATModeOff(){  // reset HC-05 and return HC-05 to std. operation
  digitalWrite(5, LOW);
  digitalWrite(ATModePin, LOW); // AT command mode off upon reset
  delay(2000);
  digitalWrite(HC05powerPin, LOW); // hc-05 off
  delay(2000);
  digitalWrite(HC05powerPin, HIGH); // hc-05 on
  delay(2000);
}

void ArdProgramModeOn(){
  btSerial.println("AT");
  delay(1000);
  btSerial.println("AT+POLAR=1,0");  // Arduino reset mode upon HC-05 connection for programming
  delay(1000);
  btSerial.println("AT+POLAR?");  // Arduino reset mode upon HC-05 connection for programming
  delay(2000);
  while (btSerial.available()) {  // Show responses from HC-05
    myChar = btSerial.read();
    Serial.print(myChar);
  }
  delay(4000);
}

void ArdProgramModeOff(){
  btSerial.println("AT");
  delay(1000);
  btSerial.println("AT+POLAR=1,1");  // Arduino normal mode no reset upon HC-05 conection
  delay(1000);
  btSerial.println("AT+POLAR?");  // Arduino reset mode upon HC-05 connection for programming
  delay(2000);
  while (btSerial.available()) {  // Show responses from HC-05
    myChar = btSerial.read();
    Serial.print(myChar);
  }
  delay(4000);
}


texts: Arduino Mega not flashable with XBee PRO S2B

texts:
I have an Arduino Mega 2560 with a libelium XBee Shield. If I have an XBee S2 mounted on it and set the two jumpers to the USB setting or remove them, I am able to flash a program onto my Arduino.

However, when I'm mounting one of my XBee PRO S2B (I have three of them available and all behave the same) on the Arduino, no matter how I set the jumpers, it is not possible to flash anything on it. I always see avrdude: stk500v2_getsync(): timeout communicating with programmer in the Arduino IDE.

Is the XBee PRO S2B incompatible with the Arduino or what might be the issue? I also tried to add an external power source additionally to the USB, but it didn't help either.

Update

After some more experimenting, I found out new details. I tried to disconnect each pin of the shield individually. While doing it, I discovered that disconnecting the reset pin from the arduino makes it possible to flash it - take a look at the XBee shield schematic, it's pin 5 from the ICSP connector; Photo:

I used a multimeter and discovered that the XBee PRO S2B CTS / DIO7 port is high, while the one from the XBee S2 is low, and so constantly resetting the arduino. I mounted the XBee PRO S2B onto the Sparkfun XBee Explorer USB and opened a serial port with PuTTY.
In contrast to the S2, the PRO S2B provides a menu with several options:

B-Bypass Mode
F-Update App
T-Timeout
V-BL Version
A-App Version
R-Reset
>

As soon as I type B, the CTS port goes low, and would prevent the arduino from resetting. Also this mode is needed to detect the module via XCTU. However, with an unmodified arduino, I wouldn't have a chance to send this letter, since the XBee is constantly resetting it. What is this menu, can it be disabled somehow?


texts: Measure cycle count and time of Digital Input

texts:
I am currently working on a project which is read a digital input signal from a machine. The machine operation is as below:

when the mold close, the machine gives the "HIGH" signal, when mold is open the machine gives "LOW" signal. A cycle is counted as one cycle when from the mold close --> open --> close.

My goal is to count the cycle and cycle time of each cycle. I am struggling when the Input comes from HIGH to LOW. Appreciate your help to give me some guildance on this project.

int MoldInput = 2;
int MoldState = 0;
int lastMoldState = 0;
int CycleTimeCounter = 0;
int CycleCount = 0;
unsigned long CycleTime;
volatile unsigned long TimeTemp1 = 0;
volatile unsigned long TimeTemp2 = 0;
void setup() {
  // put your setup code here, to run once:
  pinMode (MoldInput,INPUT);
  attachInterrupt(0, RealTimeMoldClose, RISING);
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(CycleTime);
}
void RealTimeMoldClose(){
  unsigned long t = millis();
  TimeTemp2 = t;
  CycleTime = TimeTemp2 - TimeTemp1;
  TimeTemp1 = TimeTemp2;
}


texts:
I am working on a project to blow air gently through a number of pipes and variable speed. I would like to use a standard PC case fan and have control of whether the fans are on/off and also what speed they spin at. My hope is to attach temperature sensors later and eventually blow are depending on the temperature.

It appears that PC fans on 3-wire and 4-wire systems provide variable speed by changing input voltage ranging from 3-12V  (linear voltage regulator) or with PWM set to 3.3V or 5V. Furthermore, it looks like inexpensive products exist to split/copy a single signal to multiple fans (see here).

I am hoping to control 4-8 fan speeds, as independently as possible while using as simple/standard a case fan as possible. What is the best way to drive PC case fans using the Arduino?

Reference: https://en.wikipedia.org/wiki/Computer_fan_control


texts: Problem with uploading LUFA MassStorage .hex file to Leonardo

texts: I have been trying to make my Leonardo board to work as a USB device. So I started with compiling the open source LUFA USB library demo "MassStorage" for the Leonardo board settings. Since I'm using Mac OS, I downloaded the "AVR Tools" software to upload the hex file to the board(I didn't want to use the ISP protocol to flash. Because it is not possible to remove the chip from the board to make the correct ISP circuit connection). Anyway I was managed to flash the board. But afterwards it is not detectable by the computer. The serial port is not detectable. This proves it flashed something. Afterwards I flashed it again with the original bootloader file and it was identified as before. I'm a beginner to Arduino programming and forgive me if I'm asking elementary question. What am I doing wrong?


texts: Can the Mouse library scroll horizontally?

texts:
I'm using the Mouse library with an ATmega32U4 connected to Linux via USB.

I would like to issue horizontal scroll commands, but the Mouse.move() function only seems to accept X movement, Y movement and vertical scroll parameters.

How can I send horizontal scroll commands from the Arduino to the computer?


texts: Need some explain before desigin my own custom Arduino Due board

texts:
I'd like to ask you some questions about ARM processor from Atmel like the SAM3X8E, the one used in the Arduino Due. I have found this [AVR programming guide] from abcminiuser on avrfreaks very helpful.

Q1. Why are there no ICSP pins in Arduino Due to use it to program the SAM3X8E from an external programmer instead of the USB port in the Due board?

Q2. If I want to program an Arduino Due from an external programmer which of the programmers in abcminiuser guide will do the job and give me the ability to program 8/16/32bit AVR and ARM chips from Atmel at the same time?

Q3. On the Arduino Due website I read this:

  "Uploading sketches to the SAM3X is different than the AVR Microcontrollers found in other Arduino boards because the flash memory needs to be erased before being re-programmed. Upload to the chip is managed by ROM on the SAM3X, which is run only when the chip's flash memory is empty. "

What is that mean?


texts: What is difference between NodeMCU and esp8266?

texts: Since I have no previous experience in electronics I'm getting quite confused while coming across these two terms ..I'd like to know whether they're the same or different.


texts: Connect 2 Arduino UNOs via Bluetooth? (HC-05 and HC-06)?

texts:
So I've researched this topic a lot online, but haven't found what I'm looking for. Before I tell you this, I'll give you guys an idea of what I'm trying to accomplish. Please understand that I'm an extreme beginner to Arduino, and that I've only been at this for a month or so, but plan on doing so much more.

My friend and I are building an RC car. We have an Android phone that has a downloadable application which connects to the Bluetooth HC-06 module that is on the Arduino UNO. We have configured our circuit, and it works fine! I want to go a step above and beyond, though.

My goal is to build a physical, handheld controller or remote (literally plopping everything on a breadboard), and connect that controller or remote to our car using Bluetooth. We have an HC-05 and HC-06 module, and the HC-06 is on the car. Now comes the doubt.

I understand how the android application sends characters through to the RC Car via Bluetooth; that's pretty straightforward as the two pieces are paired (using Android's Bluetooth Settings). What I don't understand is how to pair the two HC-05 and HC-06 Bluetooth modules. There isn't too much help online, I feel. I've looked and people have shown that they connect, but they don't explain the theory, so to speak.

What I want to understand is:

How the two HC-05 and HC-06 modules pair, and
How can I read input from one (remote controller) and execute an action on the other (RC car). From the app-to-Arduino, I was using Serial.available() to see if the Serial had any characters sent over from the application. I can't see how I can do that with HC-05 to HC-06 pairing, however. This concept is hard for me to grasp.

Any help is greatly appreciated. Thank you!


texts: Sending command through SPI on Arduino UNO

texts:
I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

#include <SPI.h>

int value1 = 0x8026;
int value2 = 0x0801;
int value3 = 0x8027;
int value4 = 0x0000;

void setup (void)
{
  Serial.begin (9600);
  Serial.println ("Starting");
  digitalWrite(SS, HIGH);  // ensure SS stays high for now

  // Put SCK, MOSI, SS pins into output mode
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select
  digitalWrite(SS, LOW);

  SPI.transfer (1);   // initiate transmission
  SPI.transfer (value1);
  SPI.transfer (value2);
  SPI.transfer (value3);
  SPI.transfer (value4);

  // disable Slave Select
  digitalWrite(SS, HIGH);

delay (1000);
}


texts: Wrong documentation for Mega2560 SPI Pins?

texts:
This page https://store.arduino.cc/usa/mega-2560-r3 contains the following image under the Documentation section.

It shows digital pins 10 to 13 with labels SS, MOSI, MISO, and SCK. However, this page says that those are at pins 50 to 53 https://www.arduino.cc/en/reference/SPI.

Which page is correct?


texts: I'm interested in using an Arduino for a project for taking information and sending it through a phone application. I was wondering what the cheapest option there is for an arduino with internet capabilities. From what I see, a lot of articles list they use UNOs with shields for wifi/ethernet. After looking these up, I noticed that they can get a little pricey. Is there any alternative options I may be overlooking? Thanks.


texts:
I've programmed the Arduino Uno to generate PWM corresponding to the serial input values. And it works fine with an LED. I took the connection from PWM pin 3 (where I set the output) to the base of a BC548 transistor and connected the motor in series with an external motor power supply (Vcc) and the collector and the emmitter is grounded (to both Arduino's GND pin and the external supply's). The motor had a fly wheel diode, 4N4007, and a capacitor of 1 µF for protection.

But when I connect the motor and provide it with the PWM input, it works for a few seconds and then I see a few flashes in the rx and tx LEDs, and it stops working even with a serial input or reset. I need to turn it off and then on to make it work again. The same thing repeats when I connect the motor, but it works fine with an LED.

How can I fix that??


texts: What is the difference between the two sensors?

texts: I am working on a project which requires the use of sensors and i don't know which one to use so i would like to know the difference between the two.


texts:
I have 5 of these NeoPixel LED's.

For these particular LED's, they recommend "use of a 0.1 μF capacitor between + and ground".

Here's what I've got:

The blue's are 100 μF and the little brown ones are...I have no idea. Both were just in this starter kit. Maybe 100 pF?

So, a few questions around this...

Are these actually necessary and why?
Is there any harm in using much higher capacitors than recommended?


texts:
I am working with BLE 4.2 (ESP32) that sends IMU (accel, gyro, mag) data to my mobile app (Android). Unfortunately, I can send only 20 bytes in one packet.

This is the code I have: (I am connecting the float raw data (ax, ay,...my, mz...etc) read from the accelerometer.)

char myConcatenation[20];
char myStr[","];
.
.
.
 sprintf(myConcatenation,"%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f%s%3.2f", ax, myStr, ay, myStr, az, myStr,gx,myStr, gy, myStr, gz, myStr, mx, myStr, my, myStr, mz, myStr, yaw, myStr, pitch, myStr, roll);
.
.
.
pCharacteristic->setValue(myConcatenation);

pCharacteristic->notify(); // Send the value to the app!

Do you know how to construct a code so I would notify the app with new data of 20 Byte length? For example, each packet constructed of every sensor reading:

1. (ax, ay, az)
2. (gx, gy, gz)
3. (mx, my, mz)
4. (yaw, pitch, roll)

Thank you for any advice and patience with my poor programming skills.


texts: Manual TCP connection using WiFi ESP8266 module mistyped command

texts:
The command is working fine if I type it directly to the serial interface

AT+CIPSTART="TCP","192.168.1.5",1647

But if I want to make it automatic and send it whenever I want from inside the code is not working at all.

Used this but it's not working (Serial1 is from the hardware sp)

Serial1.println("AT+CIPSTART="TCP","192.168.1.5",1647")

Any way to arrange the data?


texts: how to run 2 different servo (continuous rotation and regular servo) in parallel, not run one after other?

texts: I need to control 2 servos in parallel, whereas one is of continuous rotation and another is of regular positioning control (angle) on arduino IDE. I tried but it works one after another, not parallel. How can I do that, please suggest. Thanks.


texts: How to generate gcode for Arduino Mega 2560 and Ramps 1.4 CNC Router

texts:
I had a Prusa I3 3D Printer which use Arduino Mega 2560, Ramps 1.4 and Pololu - A4988 Stepper Motor Driver.

I want to convert my 3D printer to CNC Router using my Dremel with Flexible shaft like this.

I found the one project on instructables.com at here
http://www.instructables.com/id/Arduino-Controlled-CNC-3D-Printer

They give config for Mega 2560 as CNC router.
But i don't know how to generate g-code for these cnc router.

Please help me to generate g-code from STL, DXF and Image(PNG or SVG) files to use with this type of cnc router.


texts:
I need to hard reset (or seriously breathe life into) a stuck Arduino clone (Sunfounder UNO) which doesn't get recognized by Windows (error 43) after installing the wrong sketch. I am using the latest Arduino toolset and, before today, the setup was functional.

The problem is probably that I am writing to the serial in the setup() section like this:

void setup() {
  pinMode(a0, OUTPUT);
  pinMode(a1, OUTPUT);
  pinMode(a2, OUTPUT);
  pinMode(b1, OUTPUT);
  pinMode(m0, OUTPUT);
  pinMode(m1, OUTPUT);
  pinMode(m2, OUTPUT);
  pinMode(OK, OUTPUT);
  pinMode(KO, OUTPUT);

  pinMode(carry, INPUT);
  pinMode(result, INPUT);
  delay(1000);

  Serial.begin(9600);
  Serial.write("Arduino Tester v. 0.1\n");
}

Arduino seems to be running the code. The problem is that Windows doesn't recognize it and doesn't set up a COM port for it.

So: i'd like to nuke it and restart from scratch.

How is this done?


texts: How to find the time of any point on the graph on an Arduino serial plotter or Processing software?

texts:
I am plotting the graph of some sensor values on my Arduino serial plotter which looks something like this -

But what I want to do is hover over any point on the graph and display the time at that point. Is there any way to do that, if not with Arduino serial plotter, with Processing? Or any other tool is fine too. Thanks.


texts: Can't upload sketch to arduino Uno board

texts:
I'm trying to upload a simple sketch to my Uno board but get this error message: avrdude: stk500_recv(): programmer is not responding (full error message at the end).

I have other Uno boards who work fine so I guess it is something to do specifically with this board (which used to work) and not my system or cables (port,drivers,settings etc..).

I did a loop-back test (http://forum.arduino.cc/index.php?topic=73748.0) on  the board and it worked fine.

I read about possible solutions but nothing seems to solve this.
https://stackoverflow.com/questions/19765037/arduino-sketch-upload-issue-avrdude-stk500-recv-programmer-is-not-respondi

I also tried using an Arduino as an AVR ISP but it failed. (https://www.arduino.cc/en/Tutorial/ArduinoISP)

Any help will be appreciated, thanks in advance.

Full error message:

    avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2009 Joerg Wunsch

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

     Using Port                    : COM3
     Using Programmer              : arduino
     Overriding Baud Rate          : 115200
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xd3
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xd3

    avrdude done.  Thank you.

    Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.


texts: How can I declare an array of variable size (Globally)

texts:
I'd like to make three arrays of the same length. According to the documentation, Arrays must be defined as int myArray[10]; where 10 can be substituted for a known length (another integer), or filled with an array {2, 3, 5, 6, 7}.

However, when I attempted to declare a value int arrSize = 10; and then an array based on that size int myArray[arrSize];, I get the following: error: array bound is not an integer constant.

Is there a way to variably determine array sizes, or do I just need to hardcode them? (I was taught hardcoding is bad and something to avoid at all costs.)


texts: Using a photo resistor to detect objects of a certain color

texts:
I am trying to build a robot that detects cubes of a certain color, and later picks them up.

I was planning to use a camera and process the image, but I was told that Arduino is not capable of image processing.

Now, I was thinking that I could maybe use a photoresistor that is enclosed by a green light filter sheet (so that only the light of a certain color can pass). Thus, if my robot is facing a cube of the color I want, the photoresistor should detect this.

Is this at all possible? I know how filters work in theory, but I have never used one before.

If not, is there another way to try to detect color using an Arduino?


texts: How do I connect an MPU6050 sensor to an Arduino MKR WIFI 1010?

texts:
I've been trying to connect an MPU6050 to my MKR WIFI 1010 following these general instructions and using the I2CDev library, but I keep running into problems.
For a while the Arduino just didn't show up as connected in the IDE when all the pins were connected, which I think I've gathered was due to a lack of pull-up resistors for the SCL/SDA pins. Adding 10 kOhm pull-up resistors helped a little (in making the Arduino visible) but it would hang when trying to upload the example sketch. 2.2 kOhm resistors seemed to do the trick, where now the example sketches (MPU6050_DMP6 or MPU6050_raw) can be uploaded. They still fail to read any actual values, however. The raw sketch gives 0 for everything, and the DMP6 sketch prints
Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:
Initializing DMP...
DMP Initialization failed (code 1)

Does anyone know why the sensor still fails to give any measurements? I connect VCC and GND from the sensor to VCC (3.3V) and GND from my Arduino. SCL and SDA from the sensor are connected to VCC via 2.2 kOhm resistors and to the SCL and SDA pins of the Arduino (12 and 11). And INT from the sensor is connected to digital pin 2. (I tried this on a couple other pins like 0 and 1 since it seems from the tech specs that 2 is not an External Interrupt pin, but that didn't change anything.)
The sensor and examples worked without any extra effort on my Arduino Uno, but unfortunately I fried that with a 12V power supply by accident. I'll probably just get another Uno, but I'm curious why this didn't work, if I'm missing something about I2C or the MKR WIFI.
I'll also note that I had to add
define #BUFFER_LENGTH 64

to wire.h in order to get sketches including I2Cdev to compile (following these instructions).


texts: How can i prepare for short-circuit between 5V and GND pins?

texts:
My Arduino Uno controls a couple LEDs in a watertight enclosure. I'm running wires from ground, a data pin and the 5V pin into the enclosure. The Arduino is powered through the DC jack.

What measures can I take to handle failure of the watertight enclosure, which would short-circuit the wires? Can i protect the Arduino, or at least prevent a fire?


texts:
I have been trying to achieve a way to tap into the 16 million colors RGB provides for this LED strip. I thought of using LEDS.setBrightness(); but I have not been successful in my attempts. I have read the documentation on color fading, but I have not been able to write this to my Arduino Leonardo. Here is my code below, which cycles through the initial rainbow of 0-255. I was wondering how to get more than 0-255 if not all the colors.

#include <FastLED.h>

#define LED_COUNT 60
#define LED_OUT       13
#define BUTTON_IN     10
#define ANALOG_INPUT  A9
#define EXTRA_PIN_A    7
#define EXTRA_PIN_B   11

struct CRGB leds[LED_COUNT];
int wait_time = 5;

void setup() {
  Serial.begin(57600);
  LEDS.addLeds<WS2812B, LED_OUT, GRB>(leds, LED_COUNT);
  LEDS.show();
}

void loop() {
  //start from red
  for(int colorStep=0; colorStep <= 255; colorStep++) {
    int r = 255;
    int g = 0;
    int b = colorStep;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }

  //into blue
  for(int colorStep=255; colorStep >= 0; colorStep--) {
    int r = colorStep;
    int g = 0;
    int b = 255;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }
  //start from blue
  for(int colorStep=0; colorStep <= 255; colorStep++) {
    int r = 0;
    int g = colorStep;
    int b = 255;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }
  //into green
  for(int colorStep=255; colorStep >= 0; colorStep--) {
    int r = 0;
    int g = 255;
    int b = colorStep;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }
  //start from green
  for(int colorStep=0; colorStep <= 255; colorStep++) {
    int r = colorStep;
    int g = 255;
    int b = 0;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }
  //into yellow
  for(int colorStep=255; colorStep >= 0; colorStep--) {
    int r = 255;
    int g = colorStep;
    int b = 0;
    // Now loop though each of the LEDs and set each one to the current color
    for(int x = 0; x < LED_COUNT; x++) {
      leds[x] = CRGB(r,g,b);
    }
    // Display the colors we just set on the actual LEDs
    delay(wait_time);
    LEDS.show();
  }
} //end main loop


texts:
You can buy Arduino Nano v3 clones from Alibaba at the cost of roughly $2-$3.

I have calculated the cost for fabricating and all the parts in the BOM for Arduino Nano V3, and it ended up costing around $10 to $12 (depending on where you fabricate the board, buy the components and purchasing volume - assuming less than 100 units).

However, how are Chinese clone manufacturers able to slash the price so much it's only ~1/10 of the BOM cost.

Could it purely be due to economy of scale, lower fixed costs (cheap labor), low quality parts (How do you define low quality parts)? Or are there other factors at play as well?


texts:
I have an arduino Uno board with a screen attached on top (http://www.freetronics.com.au/pages/16x2-lcd-shield-quickstart-guide#.VUf0tMWN0iT This is the screen).

I'm trying to get it so that the screen displays the time in hours, minutes and seconds and counts on a 24 hours loop. Like a digital clock. I have it so that it can count but it just counts up to 99 then repeats.

I have this code which counts milliseconds but I need minutes and hours

    #include <Wire.h>
    #include <LiquidCrystal.h>

    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

    void setup()
{
    lcd.begin( 16, 2 );
}

    void loop()
{
    lcd.setCursor ( 0, 1);
    lcd.print(millis());
}


texts: Can I drive this relay shield with an Arduino Due?

texts:
Sorry I'm new to electronics while I've some experience in coding. This let me very curious about the Arduino Due board: it is super powerful and I can run some C++ code that I can not with the normal Arduino Uno. But I lack in electronic theory, sorry if the question is a little bit dumb.

Can I drive this shield with an Arduino Due? The Due board is at 3.3V while the relays in the shield are at 5V.

What do I need to make them run smoothly?

Actually I'd like to run 5 of those shield with only one Arduino Due board. Do I have some problem with power supply?


texts: Connect GPS module with GPS antenna SIM39EA to Arduino Uno

texts:
I bought a GPS module with GPS antenna SIM39EA online.

The manual for the GPS module is here:

http://www.vis-plus.ee/pdf/SIM39EA_Hardware_Design_V1.00.pdf

I have an Arduino board. It has 3 ground pin, one Vcc and two input/output pin.

I want to know how can I connect this module to Arduino GPS module and get GPS coordinates?