text:
KY-022 IR receiver, LED always on, no output
I've been trying to use a KY-022 to read IR signals. However no output is being produced and the LED on the board is constantly on.
Board: Arduino Uno R3
I followed the procedure found here.
The code:
#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {
  Serial.begin(9600);
  // In case the interrupt driver crashes on setup, give a clue
  // to the user what's going on.
  Serial.println("Enabling IRin");
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Enabled IRin");
}

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

The output:
Enabling IRin
Enabled IRin

The LED is constantly on, it should come on when there's a signal received. However this is not shown in the output. :/ I don't know what to do.
Pictures:

The first thing to look at is the circuit board. Are they using the resistor and LED to indicate the board is receiving power? The data sheet has a schematic showing several passive components in the "3. ApplicationCircuit" section. Here is a copy of the schematic I have used that worked with the IRremote library (Version 0.1 July, 2009 - Copyright 2009 Ken Shirriff).

I'll be honest with you, I'm completely new to this, I think the LED is connected to Signal and 5V...?

If its any help, if I dont have the reciever plugged in, I still get the same output, that it has been enabled

Let's try something simple to begin with. Add a 10k ohm or 15k ohm resistor between 5V and the circuit board output pin. Try the "IRrecvDump.ino" sketch that comes with the library (this sketch seems to provide more information about the possible type of remote you have).

I think I added the 10k resistor correctly.. nothing, no output, led is still on

I don't think the LED will flash or turn ON when an IR signal is received. Unfortunately I can not see the bottom of the circuit board in the product link you have provided so I can't be 100% certain that the LED is just a "power indicator". Could you edit your question and add a picture showing how you have everything connected?

I added the pictures! sorry for the hold up, had school and stuff, hope that helps you help me

The LED indicates power to the circuit board and will not turn on and off with a incoming IR signal. The only thing missing from your pictures is the 10 - 15k ohm pull-up resistor between 5V and the signal output. Try several different types of remote controls with the "IRrecvDump.ino" sketch. My Apple TV remote and several of my TV/cable box remotes work with the same type of IR sensor you are using. If you have access to an oscilloscope, the IR sensor could be tested for an output signal. It's possible the IR sensor is defective.

I have this IR led, an the led in the ky-022 only turn on when receive data.

Sorry for the very late update, turns out the component itself wasn't working so I got a replacement and all is fine! Slowly beginning to understand electronics, thank you for your help!

This happened to me when I "fried" my IR receiver.
Everything was fine and working until I accidentally reversed ground and +5v when putting my project back together after a tear down.
After correcting the wiring, the LED stayed on, and no reading was coming out.
Did you ever get any pins wrong?
This video show the correct wiring.
https://www.youtube.com/watch?v=iFpAqG90zY0

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Only getting error from ESP8266 AT commands
I am trying to get the ESP8266 work with Arduino AT commands. I am using the due. How do I get the ESP8266 to respond with anything other than ERROR?
Here is the current serial output:
AT
ERROR

Here is my code:
void setup() {
    Serial.begin(9600);
    Serial3.begin(115200); //Manufacture said this is the correct baud rate
}

void loop() {
    if ( Serial3.available() ) {  Serial.write( Serial3.read() );  }

    if ( Serial.available() )  {  Serial3.write( Serial.read() );  }
}

Here are my pin connections:
RX3  -> ESP TX
TX3  -> ESP RX
GND  -> GND
3.3V -> CH_PD + VCC

do you have CR/LF set in Serial Monitor?

Don't cross post. You also asked this on SO.

I didn't have CR/LF set. That fixed my problem

The AT firmware responded with ERROR because it received data, but timed out waiting for the CR/LF line ending.
AT commands must be terminated with Carriage Return '\r' and Line Feed '\n' control bytes/characters.

source: Stack Exchange

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Is a variable declaration inside a loop static declaration or dynamic?
while(condition){
    Object object = new Object();
}

So my question is, will each iteration would create a different object in different memory location or it will overwrite the once created object every iteration.

You are strongly encouraged not to use dynamic memory allocations. Due to the low ammount of memory you will get into trouble if you are not careful. Try to avoid calls like new and malloc. instead you should use Object object(args); to initialize your object in the loop. It will be disposed at the end of the loop automatically.

This code is not proper C/C++, it should be Object* object = new Object(); otherwise this would not even compile.

It will be created every iteration.
Assuming, you are not using it to add to a list (e.g. to use in later loops), what you better can do is make it in a global, you also don't need to use 'new', thus:
Object object;

Also, if you do not delete/remove the object at the end of each while condition (with the delete keyword), you will lose the memory (and this is a memory leak). Also, you run the risk of memory shortage (the Uno has only a few KB of memory).
What I also miss in your code is the pointer (*, because the new keyword creates a pointer), and also Obj and Object are inconsistent types (they should be equal), so:
Object* object = new Object();

If you only need the object within the condition and it can be removed in the next while, than you don't need to use new, so just declare it as a vaiable
Object object;

This also has the benefit that the (local) variable will be destroyed at the end of scope (which is at the end of the while).

maybe also mention cleaning up the object when using new

@ratchetfreak I already put a notice for that, but I extended the comment slightly.

Did you perhaps mean memory leak instead of memory breach? First time I hear "memory breach", google does not seem to know what a memory breach is neither.

@wondrea memory leak is indeed a better word, I change it

Dynamic object creation is using operator new. Operator new creates object on heap and the object exits until you delete it with operator delete.
Object object creates object on stack. It will be removed from stack when the variable goes out of scope on the end of the block.
Some classes have copy constructors. If your Object object = new Object() compiles, then the class Object has copy constructor. The code creates an object on stack, then creates an object on heap and then copies it's content into object on stack. The object on heap stays and you have no pointer to it to delete it. The program soon crashes on low memory.
Static variables have keyword static. If you would have static Object* object = new Object(), then the pointer is created on global level and the object on heap is created and assigned only ones.
EDIT:
I tested this. Class String has a copy constructor, but the Arduino compiler doesn't allow String s = new String(a). It can be misleaded with String s = *(new String(a)) (a is some variable).

reason for the down-vote?

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Extract binary data from text string. Like Perl pack, not just regexp
If I have data coming into an Arduino in an ASCII serial format from some external device (or from a PC, or whatever) and I want to extract binary values from that data and log it or put it on a little display or react to it or whatever there are a few ways I can do it. But it seems like there should be a reversed version of sprintf, mashed up with regexp, mashed up with Perls pack/unpack that would make it easy and configurable.
For example, let's say I'm getting hex numbers from a data logger. something like
c,03,1234,5678,9ABC
where c is just a code telling me this line is channel data, there are 3 channels installed, and then there are the 3 sets of data. I can use split or something like that and then extract the values, convert the hex to binary, apply Y=mX+B and display the channel readings. If a channel goes flat, I can sound an alarm, etc... No worries.
But then I have a different data logger plugged in, and this one uses a different format. Like decimal raw ADC counts. It spits out
2342 1313 234236
Now I gotta recode.
But wait, what if I just had a regexp in eeprom and I used that to extract the data? Something like /^c,\X+,(\X+),(\X+),(\X+)$/ for the first logger and /^(\d+) (\d+) (\d+)$/ for the second. That would be really cool because I could pretty much extract data from any serial device for local display. No need to reprogram, just update the regexp. And there is a nice regexp library:
https://github.com/nickgammon/Regexp
although it uses the LUA regexp syntax.
Oh, but that won't work... because although my program in the Arduino gets back 3 values from the regexp, it doesn't know that the first set are hex strings, and the second set are decimal.
Now, if I was doing this in Perl, I'd just apply a pack string to the binary data. But then pack can't reject a bad match, it always returns a result, even if the input wasn't valid.
Doesn't it seem like the regexp should be able to return /binary/ values instead of just the string? It knows those values are hex. And shouldn't pack be able to do matching against the other characters in the string and reject the value if it's not a match?
Seems to me like there is a hole in our standard libraries. Something that does both simple matches, and converts data to binary return values on the fly.
Or is that too much to ask from an engine? Perhaps few people would use it; better to just hardcode for the rare times you need something like this?

atoi(), strtol(), etc see https://stackoverflow.com/questions/20654424/atoi-from-hex-representation-string also https://stackoverflow.com/questions/33662818/arduino-serial-read-and-parse-hex

Something that does both simple matches, and converts data to binary
  return values on the fly.

You are describing sscanf(). It is way less powerful than
regexps when it comes to pattern matching, but it seems to closely match
your requirements.
Dummy example:
const int FORMAT_COUNT = 2;
const char * formats[FORMAT_COUNT] = {
    "c,%*x,%lx,%lx,%lx",  // first data logger
    "%lu %lu %lu"         // second data logger
};

// Here goes the data.
unsigned long channels[3];

// Try to parse using all the known formats.
void parse(const char *message)
{
    for (int i = 0; i < FORMAT_COUNT; i++) {
        int ret = sscanf(message, formats[i],
                &channels[0], &channels[1], &channels[2]);
        if (ret == 3) {
            Serial.print("Message \"");
            Serial.print(message);
            Serial.print("\" matched with format \"");
            Serial.print(formats[i]);
            Serial.println("\"");
            return;
        }
    }
    Serial.println("Could not parse message.");
}

Sample output:
Message "c,03,1234,5678,9ABC" matched with format "c,%*x,%lx,%lx,%lx"
Message "2342 1313 234236" matched with format "%lu %lu %lu"

Perfect! Thank you! I actually knew about scanf but didnt realize it was that powerful.

Yes, but it doesn't really know something is hex. What about the patterns:
[\dA-F]
[0-9A-Fa-f]

And so on. The regexp library is simply a way of extracting out substrings of a target string. It doesn't make a heap of sense for it to try to auto-detect the type of the returned string. For example, a GUID might be a lot of hex digits. Do you want something like 182676d07497c511f850 to be somehow converted into binary? And then what? Compressed into an int?
In fact it doesn't return (decimal) numbers anyway, it returns a string which may or may not be convertible into a number. Chris Stratton's suggestion of using atoi, sttol and so on is the logical way to go. Just have a flag in your EEPROM that tells the decoding routine what format the input data is. Also, for simple string sequences, don't forget strtok.


text:
Where to connect an external power source for an Arduino motor driver shield to?
I have a BYJ48 stepper motor and an ULN2003A motor driver shield shield.
In many tutorials I read:

do not to draw current from the 5V on the Arduino rail, but use an
  external power source, since the motor can draw quite some current

Which of these options to they mean by this?

Connect an external power adapter to the Arduino and connect the
  ULN2003A board to the Vin pin and GND on the Arduino

or

Connect the motor shield itself to an external power adapter and connect it to the + and - pin on the motor shield

or perhaps both are valid solutions?
The board I use is this one.

Link to the product you refer to?

https://www.ebay.nl/itm/5V-4-Phase-Geared-Stepper-Motor-with-ULN2003A-Driver-Board-28BYJ-48-Arduino/121433812858 I added it to the my question as well

You are missing a connection from the green wire to the Arduino GND.

I don't see the schematic for the motor driver.

@BasvanDijk where did you get your "external 5V power supply"? did you make it?

@alcor bought it from https://arduino-tutorials.net/r/ZsECKh
I also made a tutorial about this motor with the power from an external power supply https://arduino-tutorials.net/tutorial/control-28byj-48-stepper-with-uln2003-driver-with-arduino

thanks, @BasvanDijk! I didn't know you had that great site. I was looking for something prettier than an external 5v source like that, but maybe I'm too spoiled :P thanks again!

There are two things you need to do:

Prevent the motor drawing its power from the micro-controller board.
Make sure that all the grounds are connected but avoiding motor current return through the micro-controller board.

simulate this circuit – Schematic created using CircuitLab
Figure 1. A good wiring configuration. The heavy wires carry the motor current.
Note that there is one ground connection between the micro-controller and the motor system. The return current for the 12 V supply does not pass through the micro-controller board.

Ok, what I have now is that the Arduino powered via the USB connection. The motor shield is complete independent powered with a 5V adapter. As shown on the eBay picture, there is a + and - pin on the driver board. This is where I connected the external power supply to. I did not connect the ground of the Arduino with the - pin in any way as shown in the picture.

And? Does it work or not? You need to connect the GND/- as I have shown for correct operation, otherwise there is no return path from the micro outputs 0 to 4.

Yeah it does work, but I still have my question. Since another option is to connect the external power supply directly in my Arduino and connect the motordriver + and - pin to the Vin and GND on the Arduino

Read my answer again. I explained why not to do that twice.

Perhaps I misunderstood "Prevent the motor drawing its power from the micro-controller board." I thought you referred to the USB provided 5V. For 12V I understand, but my motor is powered by 5V which the Arduino should be able to handle. This made me think I could power the Arduino as well as the motor on the external power supply.

That will be OK if the Arduino GND/- and stepper '-' are connected only at the power supply.


text:
analogWrite(DAC0, X), Analog voltage on DAC0 pin is higher for lower X value - is this normal?
I am using an Arduino DUE. Using the analogWrite(DAC0, X) command I am writing an analog value to this pin. X = 0 - 255 as I understand it.
I am observing that when X is lower, the voltage on DAC0 is higher nad when X is higher the voltage is lower.
Is that expected?
My code is simple:
void setup()
{
  analogWriteResolution(12);
}

void loop()
{
  analogWrite(DAC0, 10 );
}

voltage is lower ... how do you know what the output voltage is? ... you have not described how you are measuring the voltage.

Using a DMM between the DAC0 pin and GND.

I don't understand. How else does one measure voltage?

@jsotola  The load? I'm not sure what you are getting at.

Look, comments under questions are for clarifying the question, not trying to answer them obliquely or not. If you want to ask under what load the measurement was made, then ask it.

That doesn’t sound right. Try setting x to 0 and measure with DC. You should get ~0.56 V. Repeat with 4095, and you should get ~2.76 V.
Also, note that with analogWriteResolution(12) your range is not 8-bits (0-255), but 12-bits (0-4095).
The output should follow:
Vout = Vref * Xin⧸(2N-1) + Voffset
where

Voffset = 0.56 V
Vref = 2.2 V
0 ≤ Xin ≤ 4095

According to the page about analogWrite: Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs. - so that shouldn't be an issue.

@NickGammon Oops, that slipped passed me. I'll edit. Thanks


text:
Arduino Rotary Encoder Pulses?
I made an program so if I turn on my rotary encoder the position and the rotation comes on a LCD screen. But I need to change it a bit up for my teacher, she wants to see the graph of the pulses on the serial monitor. I searched it up and can't find a solution? Any help?
My program:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#define outputA 2
#define outputB 4
int counter = 0;
int angle = 0;
int aState;
int aLastState;
int lastAngle = 0;
String rotationDirection;
String savedRotationDirection;

void setup() {
  pinMode (outputA,INPUT);
  pinMode (outputB,INPUT);

  aLastState = digitalRead(outputA);
  lcd.begin();

     }

void loop() {
  aState = digitalRead(outputA);
  if (aState != aLastState){
     if (digitalRead(outputB) != aState) {
       counter ++;
       angle ++;
     }
     else {
       counter--;
       angle --;
     }
     if (counter >=30 ) {
      counter = 0;
     }

     if (angle < lastAngle){
      rotationDirection = "CCW";
     }
     else {
      if (angle > lastAngle){
        rotationDirection = "CW";
      }
      else {
        rotationDirection = savedRotationDirection;
      }
     }
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print("Position: ");
     lcd.print(int(angle)*(-1));
     lcd.print((char)223);
     lcd.setCursor(0,1);
     lcd.print("Rotation: ");
     lcd.print(rotationDirection);
     savedRotationDirection = rotationDirection;
     lastAngle = angle;
  }
  aLastState = aState;

}

My program:  is hard to read formatted like that

almost every Arduino example uses prints to Serial Monitor

I searched it up ... what did you search for?

Just a few comments on your code: 1. You can remove counter, as you never use it. 2. aState and rotationDirection should be local variables. 3. savedRotationDirection serves no useful purpose: you can just remove every line in which it appears. 4. lastAngle is not useful either: you know the angle increases when you do angle++, and it decreases when you do angle--.

Add Serial.begin(115200); in setup() and use Serial.println() or Serial.print() to print to Serial.
In Arduino IDE open Serial Monitor and set baud rate to 115200.
EDIT: The question turned out to be about Serial Plotter. Maximilian Gerhardt answered in a comment :

If you want multiple data streams (graphs) you need to seperate them
  by a comma: Serial.println( String(digitalRead(outputA)) + "," +
  String(digitalRead(outputB)));

Nothing's happening. My question is how to see the graph of the pulse in the serial monitor?

Serial Plotter in IDE?

Used it but still nothing happens.

Used this:
Serial.println(digitalRead(outputA));
Serial.println(digitalRead(outputB));
Now I only get one of the 2. Is there a way to get both but under eachother?

If you want multiple data streams (graphs) you need to seperate them by a comma: Serial.println( String(digitalRead(outputA)) + "," + String(digitalRead(outputB))); (https://www.norwegiancreations.com/2016/01/tutorial-multiple-values-in-the-arduino-ide-serial-plotter/) @user43154

Yes, that worked thanks. Further information I'll search first by myself. Thanks!


text:
Arduino ModBus RTU master communication with Power Meter problem
i have an arduino UNO with RS485 module.
I have made this connection:
And i have an problem with communication of this module with power meter
"InePro PRO-1Mod"
(datasheet) over ModBus protocol. I want for example read an L1 Voltage value, which i know from the manual (page 24 & 25) that this value is stored in "read holding register" with adrress 5002. I should communicate with these paramaters:

Baud rate 9600
8 data bits
even parity
1 stop bit

There is also mention about 120 ohms resistor placed by the power meter (but it is 15cm long cable, and even with the resistor there is no change)
I have tried using many of ModBus libraries and for now none of them doesn't work. I have tried "Modbus-Master-Slave-for-Arduino" , "ModbusMaster and now at last i am using this "simple-modbus".
I think that with that simple modbus library i went far as i can, but it is still doesn't working, but i see on the display of power meter that there is some try to communication (i see a black dot which shows modbus communication)
but i don't receive any useful data.
I am using this code:
    #include <SimpleModbusMaster.h>
#include <AltSoftSerial.h>

#define TxEnablePin 2                    // RS485 modbus direction control pin:
#define baud 9600                           // modbus port speed:
#define timeout 1000                        // modbus timeout in mSec:
#define polling 500                         // modbus scan rate in mSec:
#define retry_count 15

#define TOTAL_NO_OF_REGISTERS 1// number of registers to poll for:

AltSoftSerial altSerial;

enum
{
 PACKET1,
 TOTAL_NO_OF_PACKETS                       // leave this last entry
};

Packet packets[TOTAL_NO_OF_PACKETS];        // array of Packets to be configured

//struct packetPointer packet1 = &packets[PACKET1];
unsigned int regs[TOTAL_NO_OF_REGISTERS];   // master register array
long previousMillis = 0;
long interval = 1200;
unsigned long currentMillis;

void setup() {
 Serial.begin(9600);
 altSerial.begin(9600);
 altSerial.println("Hello World");
 modbus_construct(&packets[PACKET1], 5, READ_HOLDING_REGISTERS, 5000, 2, 0);  //initialize packet
 modbus_configure(&Serial, baud, SERIAL_8E1, timeout, polling, retry_count, TxEnablePin, packets, TOTAL_NO_OF_PACKETS, regs);
}

void loop() {
 modbus_update();

 float Power;
 unsigned long temp = (unsigned long)regs[1] << 16 | regs[0];
 Power = *(float*)&temp;

  currentMillis = millis();
 if (currentMillis - previousMillis >= interval)
 {
   altSerial.print("Exception errors: ");
   altSerial.println(packets[PACKET1].exception_errors);

   altSerial.print("Failed requests: ");
   altSerial.println(packets[PACKET1].failed_requests);

   altSerial.print("Successful requests: ");
   altSerial.println(packets[PACKET1].successful_requests);
   altSerial.print("Low byte: ");
   altSerial.println(regs[0]);
   altSerial.print("High byte: ");
   altSerial.println(regs[1]);
   altSerial.print("Power ");
   altSerial.println(Power);
   altSerial.println("----------");

   previousMillis = currentMillis;
 }

}

And i have got only this output in the pc (its repeating of course):
----------
Exception errors: 0
Failed requests: 5
Successful requests: 0
Low byte: 0
High byte: 260
Power 0.00
----------

Altserial library i am using together with USB2TTL convertor on pins 8 & 9,
to see output.
I should mention that there is only A and B screw terminals on power meter, so i have no option to make common ground connection. I also using an 15cm twisted pair cable UTP.
Can someone help me to make it work ?
I have tried to change adrress of holding register to 0x5000 or 5002, tried changing number of registers.
I have tried to connect rs485 module with USB2TTL to pc and run software called "qModMaster" and it works, but with arduino it doesn't work.
Slave ID (power meter) is 5.
Thank you, for your help.

Can u help me,, i have a same problem. i try to read value from pulse meter autonics and display to serial monitor arduino. my pulse meter setting is : baud rate 9600
address 02 with your code above, can i solve my problem? or any code have to change...
thankyou...

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review

I don't know which type of "pulse meter autonics" you use but i found manual for these types: MP5S_MP5Y_MP5W_MP5M and in manual they said that they are NOT using PARITY BIT. So you should change "SERIAL_8E1" to "SERIAL_8N1"

I edited my answer, for more help look at it.

My reference is this vidio link. in that video show that pulse meter Mp5Y can communicate with other system (mkrokontroller/arduino) and the measurement result/ PV can display on 7 segmen

I have made it. Now it is working. I only checks A & B cables (tried a new one) and change address of register from 5000 to 0x5000 and now it works. I thought that this library already give 0x before address, because i didn't see it anywhere with 0x before.
An advice for people with the same problems:
Most of the devices which is using RS485 and ModBus protocol (and have an some kind of display) shows an communication (over 485 & modbus) on display by some kind of mark, for example in my case it was an "dot" which blinks when there's an communication. When this mark is shown, it is sign of that the communication settings is right, so data, parity bit, stop bit & baudrate is OK (data has successfully reached the dest. device).
After that, these devices send you an error message back on its line. So if you have problems with getting data, you should send your message (ask) from the arduino to that device, over an Transmit pin from arduino (of course trough an converter, for example max485) and the Receiving pin (side) connect to your PC through again some kind of converter from UART to USB. (Warning: you should have the same ground potential, so wire all grounds together)
Install some software to communication for modBus on PC (i am using this soft: https://www.simplymodbus.ca/ | you can use demo ) After that let arduino sent an message and receive it by PC. (in simplymodbus look at the "response") read that code and look to the manual for the device you using, where there should be an description of error codes, if not look at this doc.: http://www.simplymodbus.ca/exceptions.htm or THIS).After that you will have an better look on what is going on and where there is a problem.

Using the solution i write above, i figured out that there was a problem with "Illegal Data Address", received "02" exception response code.

I'm using a mp5w pulse meter, the settings:

Baud rate : 9600
Address : 02
Parity : none
Stop bit : 1

Modbus memory map table for measurement value /(PV) :

Modebus : 31002
Address  : 03E9
Size    : 5

As i look into the manual, there is NO sign that these pulse meters uses an ModBus protocol, only an RS485. In this manual link on page M-26 (M-27 is last page) so the first before last page. There is this text: "The comunication control ordering of MP5 series is a private protocol (not compatible with other system)" and then the description of this private protocol follows.

Then you can't use this library, it will not work at any settings.

My reference is this vidio link. in that video show that pulse meter Mp5Y can communicate with other system (mkrokontroller/arduino) and the measurement result/ PV can display on 7 segmen.


text:
Installing Optiboot loader for pro mini 3.3V 8MHz
I have tried to install a better bootloader in some chinese Arduino pro mini boards. I have tried the OptiLoader application via an ArduinoAsISP. I failed in some way. The boards got unstable, I can not repeat boot installation, I can not upload any application. They both time out.
This is the result from Atmega_Board_Detector most of the time.
Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb 24 2018 at 10:27:05 with Arduino IDE 10805.
Attempting to enter ICSP programming mode ......................................
................
Failed to enter programming mode. Double-check wiring!
Programming mode off.

Below is the result from Atmega_Board_Detector after many tries when it suddenly gave one answer. Nothing is changed in hardware or software between the test above and this test.
Question: Anything in this dump that says what I did wrong?
Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb 24 2018 at 10:27:05 with Arduino IDE 10805.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xE2
HFuse = 0xDA
EFuse = 0xFD
Lock byte = 0xFF
Clock calibration = 0x48
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 2048 bytes starting at 7800

Bootloader:

7800: 0x0C 0x94 0x34 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7810: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7820: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7830: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7840: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7850: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C
7860: 0x0C 0x94 0x51 0x3C 0x0C 0x94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0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
B0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
C0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
D0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
E0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
F0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF

Programming mode off.

what is the part number of the controller chip?

On the target Pro Mini is an ATMEL MEGA328P AU, On the Arduino as ISP is a MEGA328P-PU


text:
Propane injection software compiles, uploads, doesn't work
Looking for some help here. I have written out some code to add propane injection for my forklift. It is supposed to read three analog inputs, add them together and multiply the sum by three. There is an interrupt which is triggered by a hall effect sensor which is supposed to fire a solenoid valve for a duration of microseconds. I have mocked this up on a breadboard with a attiny85 pulsing the hall effect pin and nothing happens. Would appreciate some one having a look at the code and letting me know where I went wrong. Thanks.
const byte interruptPin = 2; //this is the interrupt pin hall sensor//
int mpPin = A3; //manifold pressure sensor//
int tpsPin = A4; //throttle position sensor//
int tunePin = A5; //tune pot 10k//
volatile byte inj; //this will end up being the duration of the injector pulse//
int mpValue = 0; //setting manifold variable to zero//
int tpsValue = 0; //setting throttle positon sensor value to zero//
int tuneValue = 0; //setting tune value sensor variable to zero//
int injValue = 0; //setting injection variable to zero//

void setup() {
    pinMode(12, OUTPUT);  //this is the pin that fires the injector//
    pinMode(interruptPin, INPUT_PULLUP); //set the interrupt pin to high pull up //
    attachInterrupt(digitalPinToInterrupt(interruptPin), shot, LOW);  //set the interrupt to trigger shot isr on low//
}

void loop() {
    tpsValue = analogRead(tpsPin); //read the throttle positon sensor//
    mpValue = analogRead(mpPin);//read the manifold pressure sensor//
    tuneValue = analogRead(tunePin); //read the tune sensor//
    injValue = (tpsValue + mpValue + tuneValue) * 4; // add the three sensors together and assign the value to inj//
}

void shot() {
    digitalWrite, 12, HIGH; // initilize injector powerup//
    delayMicroseconds(inj); //delay the calculated value  in microseconds//
    digitalWrite, 12, LOW; //shut down the injector//
}

please use the code button to format the code (select the code text and click the {} button) ... also indent the code properly

pulsing the hall effect pin and nothing happens  ... hall-effect sensor is an input device. ... it is not an output device ..... do you have an actual circuit?

add the three sensors together and assign the value to inj - no, that's not what you're doing there. You're doing something else. Can you spot what it is?

@jsotola I assume he means "pulsing" as in "waving a magnet around near it to trigger it".

Also asked at: http://forum.arduino.cc/index.php?topic=531656 If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information.

I can see two things wrong with your code at first glance.  First is the kind of interrupt you're using:
attachInterrupt(digitalPinToInterrupt(interruptPin), shot, LOW);

A LOW interrupt keeps triggering over and over again all the time the input is low.  It's a special interrupt type that is seldom used for anything except waking up the MCU or handling external peripherals with persistent interrupt indication.  Instead you should be using FALLING which will trigger once and once only when the input transitions from HIGH to LOW.
attachInterrupt(digitalPinToInterrupt(interruptPin), shot, FALLING);

Secondly you have two variables that seem to be intended to do the same thing - store the delay time for your output pulse.  And that's caused confusion:
injValue = (tpsValue + mpValue + tuneValue) * 4; // add the three sensors together and assign the value to inj//

... and then later ...
delayMicroseconds(inj); //delay the calculated value  in microseconds//

In your comments you reference the second variable, but the code uses the first one. Change that so it uses just one (volatile) variable:
inj = (tpsValue + mpValue + tuneValue) * 4; // add the three sensors together and assign the value to inj//

Alternatively, and perhaps much safer, is to assign the result of the calculation inside a critical section, in which case having two variables is useful:
injValue = (tpsValue + mpValue + tuneValue) * 4; // add the three sensors together and assign the value to inj//
noInterrupts();
inj = injValue;
interrupts();

This will prevent your interrupt triggering whilst the value is being calculated and placed into the inj variable which could result in the inj variable containing gibberish, which could cause your engine to explode.

Thanks for the response. Silly mistakes, but my first time writing any code other really basic stuff. So to clarify. For this test setup I am pulsiing pin 2 high than low with the Attiny 1second on/off in place of the 2n2222 switched by the hall sensor. Pin 12  is connected to an LED, 1K resistor than ground. In place of the sensors A3,A4 and A5 are connected to +5V  through a diode (to drop voltage to 4.2v) and 1K resistor. I made the changes suggested but pin 12 is still not  getting triggered. I have tested the hardware parts  and they are all working correctly. Hmmmm.

Are you sure it's not getting triggered? It won't be triggered for long - you'd need an oscilloscope to see anything from it.  Try making your delay much much longer instead of a few milliseconds at most.

Tried plugging (13000) into the delay instead of (inj) still not triggering the LED. Left my oscilloscope at work this weekend. Should be able to see 13ms flash though?

If you're lucky. Try using delay(100) instead.

Tried using delay(100), no go. Flashed blink example program with the delays set to delayMicroseconds(1000) and can see the LED flash. Think i still have and error with my interrrupt. or maybe the way im asigning things at the start of the program. Is this correct.

Everything else looks good. Maybe the hall effect sensor isn't triggering the interrupt. You need your scope.

Yes will have scope tomorrow. Again to clarify not using a hall sensor on pin 2. Using high/low 1 second pulses on attiny (blink) connected to pin 2 on the UNO. Have also tried plugging and unplugging jumper from pin 2 to ground still not triggering isr. Ill post what i see on the scope tomorrow. Thanks for all your help, feels like im finally getting somewhere on this project. All the hardware is in place and tested on the forklift. Just a matter of getting this to work and a few hours  of tuning.

What is your main board?

UNO is the board. The Attiny is just standing in for the hall sensor signal for testing.I have another UNO board somewhere maybe i should try it?

I was just wondering if the board you were using didn't have an interrupt on pin 2. The Uno does, though, so that's not a problem.  Try writing a sketch that just uses an interrupt to toggle an LED. Keep it the most simple sketch you can imagine.

Something like this: https://pastebin.com/NgbsZ67e

Thanks Majenko.Tried the sketch you linked to and it works. Noticed that it references pin 0 for the interrupt but switches on pin 2. So i brought home the scope (hantek) and tied to pin 12 but did not see anything. I found my other uno board and tried that as well. Then tried using one uno set to blink on pin 12 to toggle pin 2 on the board with the propane program. None of the above worked. Removed everything from the ISR except.

digitalWrite(13, HIGH)

Which should make pin 13 stay high once the interrupt is tripped. I think? Sorry about the screwed up posts. Big hands and a netbook dont work well together and i keep hitting enter by mistake.

Pin 2 is interrupt 0 (on the Uno). attachInterrupt uses an interrupt number not a pin number, but you can use (as you did) digitalPinToInterrupt() to translate a pin number into an interrupt number.


text:
Properly using separate tabs with Arduino IDE
I'm trying to split up a large project of mine into separate tabs in the Arduino IDE and I'm having more than a few troubles with it. My main trouble is finding a way to have routines in extra tabs access the Serial object; because it's really hard to debug things with Serial.println() otherwise. All I get, though, is "'Serial' was not declared in this scope".
There appears to be some kind of trick to this? I've noticed that "byte" or "bool" needs to be declared in .cpp tabs and .h tabs but not on the main one?
Is there some kind of easy way to set this up so that I don't need to constantly #include <stdbool.h> and typedef unsigned char byte;?
Current issue: Main file:
void setup() {
  Serial.begin(500000);
  PrintMessage();
}

void loop() {
}

driver.ino file:
byte PrintMessge () {
  Serial.println("printin");
}

and on compiling:
error: 'PrintMessage' was not declared in this scope

EDIT: Found a silly typo. Problem solved.

Did you try #include <Arduino.h> at the beginning? That should expose the Serial object. Otherwise you'll need to show us the code files in which the error occurs.

This question is more about C/C++ header basics rather than Arduino. Anyways, you should have the following file structure: Code in .cppfiles, Header in .h files. Main sketch either .ino or .cpp (for cpp remember that you must explicitly write out the function prototypes!)
So for your small example that would be:
main.ino:
#include "driver.h"
void setup() {
  Serial.begin(500000);
  PrintMessage();
}

void loop() {
}

driver.cpp
#include "driver.h"
byte PrintMessage () {
  Serial.println("printin");
  return 0; //previously had no return although returning 'byte'.
}

driver.h
 //Always use include guards
 #ifndef DRIVER_H
 #define DRIVER_H

 #include <Arduino.h>
 //All function prototypes from driver.cpp.
 byte PrintMessage();

 #endif /* DRIVER_H */

Also corrected a typo from PrintMessge to PrintMessage. This is the "professional" way to do it, seperate implementation and header files.

Tabs are actually quite simple:

If it's named <something>.ino it will get merged with the main tab. It's just like working in one big file and you don't need to do anything special.
If it's named <something>.cpp or <something>.c it's a completely separate translation unit and has to be manually "enroled" into the Arduino system by including the Arduino.h header.

So it's simplest to just name them as INO files not CPP files and you don't have to do anything special:

That's not working out for me for some reason. I'm getting the compilation error No such file or directory at the line #include "drtiver.ino"

Why are you trying to include an ino file???

Because if I don't then I get errors that make less sense. Main file:
void setup() {   Serial.begin(500000);   PrintMessage(); }
driver.ino file:
byte ReadMessge () {   Serial.println("printin"); } Error 'PrintMessage' not declared in this scope.

Um... yes? You'd expect that when you have one calling PrintMessage and the other providing ReadMessage...

Typo. They're both PrintMessage(). Will edit comment as soon as it lets me.

See the images I posted in my answer. That works. If it's not working for you then you have done something else wrong. You will have to post more details in your question.

Main question edited.

You can't spell Message...

I'll assume that was a typo too...


text:
Changing Arduino Outputs into Binary
I am new to Arduino so please give me some advice on this really simple problem. I am currently using an Arduino Mega in a school project to make 4 capacitive sensors which are supposed to receive an input when you touch the sensors, and I have programmed the arduino such that you will light up an LED upon touching the sensors.
Now the problem is after I light up the LEDs the serial data monitor gives me many different numbers when I am touching the sensors. Is it actually possible for me to tweak my program such that outputs of my sensor will show up as a single line of '0' when the sensor is not being touched and '1' when the sensor is being touched? This would really help me in the quantifying of some of the data I would wish to collect from my experiments with the sensors.
My code is
#include <CapacitiveSensor.h>

CapacitiveSensor   cs_2_4 = CapacitiveSensor(2,4); // 1M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
CapacitiveSensor   cs_5_7 = CapacitiveSensor(5,7);
CapacitiveSensor   cs_8_10 = CapacitiveSensor(8,10);
CapacitiveSensor   cs_11_13 = CapacitiveSensor(11,13);

void setup()
{
   cs_2_4.set_CS_AutocaL_Millis(0xFFFFFFFF);// turn off autocalibrate on channel 1
   cs_5_7.set_CS_AutocaL_Millis(0xFFFFFFFF);
   cs_8_10.set_CS_AutocaL_Millis(0xFFFFFFFF);
   cs_11_13.set_CS_AutocaL_Millis(0xFFFFFFFF);

   Serial.begin(9600);
   pinMode(3,OUTPUT);
   pinMode(6,OUTPUT);
   pinMode(9,OUTPUT);
   pinMode(12,OUTPUT);
}

void loop()
{
 long sensor1 =  cs_2_4.capacitiveSensor(50);
 long sensor2 =  cs_5_7.capacitiveSensor(50);
 long sensor3 =  cs_8_10.capacitiveSensor(50);
 long sensor4 =  cs_11_13.capacitiveSensor(50);
Serial.print("\t");
Serial.println(sensor1, BIN);  // print sensor output
Serial.print("\t");
Serial.print(sensor2, BIN);
Serial.print("\t");
Serial.print(sensor3, BIN);
Serial.print("\t");
Serial.print(sensor4, BIN);

    if(sensor1 >= 1000)
   {
    digitalWrite(3,HIGH);
   }
   else{
    digitalWrite(3,LOW);
   }
     if(sensor2 >= 1000)
   {
    digitalWrite(6,HIGH);
   }
   else{
    digitalWrite(6,LOW);
   }
    if(sensor3 >= 1000)
   {
    digitalWrite(9,HIGH);
   }
   else{
    digitalWrite(9,LOW);
   }
    if(sensor4 >= 1000)
   {
    digitalWrite(12,HIGH);
   }
   else{
    digitalWrite(12,LOW);
   }
   }

and the output that I end up receiving is

Hence it would be really great if I could tweak my code such that the output on the serial monitor would be '0' when there is no output(Not touching sensor) and '1' when there is an output (touching sensor)
Thanks a lot for the help once again!

It sounds like what you want isn't really "binary", nor the bit-to-characters expansion of the touch readings.
Rather it sounds like what you want to do is to print the character '0' or '1' for the state of each button.  You already have the decisioning code for your outputs, so you can simply extend it for the serial prints:
if(sensor1 >= 1000) {
   digitalWrite(3,HIGH);
   Serial.print("1");
} else{
   digitalWrite(3,LOW);
   Serial.print("0");
}

and so on, with the next set having tabs and the last a newline.
Worth noting, intermixing the printing and digital outputs will put some time delay between the outputs (potentially quite a bit if the evaluation gets ahead of the serial buffers), so another option could to do all the outputs and then all the prints, or store the decisions in a bit mask for later printins, etc.

capacitiveSensor returns an analog value so you need to set a threshold for the point where 0 (AKA false) becomes 1 (AKA true):
long touchThreshold = 123;  // Adjust this according to your application

...
boolean sensor1 = (cs_2_4.capacitiveSensor(50) > touchThreshold) ? true : false;

If you don't recognize that syntax, it's the conditional operator but you could just as well use if.


text:
DC motors not running using PWM and L298N motor driver
I'm just beginning to understand Arduino. Please bear with me. I have a collision avoidance car running on Arduino Uno, WB291111 L298N motor driver, SG90 servo, Arduino Shield v5, and HC-SR04 ultrasonic sensor. Also, I have the entire setup running on 8.4v batteries. If I just use HIGH/LOW on the motors, it will run without any problems. But if I use the PWM to run the motors on different speeds, it will NOT run at all. The sensor and servo works, but not the motors.  See my codes below. Let me know if you need further details. Any help is greatly appreciated.
#include <Servo.h>
#include <NewPing.h>

//our L298N control pins
const int enA = 10;
const int in1 = 6;
const int in2 = 7;

const int enB = 9;
const int in3 = 4;
const int in4 = 5;

//sensor pins
#define trig_pin A2
#define echo_pin A1

#define maximum_distance 500
boolean goesForward = false;
int distance = 100;

NewPing sonar(trig_pin, echo_pin, maximum_distance);
unsigned int uS;

#define SERVO_PIN 11
Servo servo_motor;

void setup(){
  Serial.begin(115200);
  pinMode(enA, OUTPUT);
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

  servo_motor.attach(SERVO_PIN);

  servo_motor.write(115);
  delay(2000);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
  distance = readPing();
  delay(100);
}

void loop(){

  int distanceRight = 0;
  int distanceLeft = 0;
  delay(50);

  if (distance <= 20){
    moveStop();
    delay(300);
    moveBackward();
    delay(200);
    moveStop();
    delay(300);
    distanceRight = lookRight();
    delay(200);
    distanceLeft = lookLeft();
    delay(200);

    if (distance >= distanceLeft){
      turnRight();
      moveStop();
    }
    else{
      turnLeft();
      moveStop();
    }
  }
  else{
    moveForward();
  }
    distance = readPing();
}

int lookRight(){
  Serial.print("Look Right");
  servo_motor.write(50);
  delay(500);
  int distance = readPing();
  delay(100);
  servo_motor.write(115);
  return distance;
}

int lookLeft(){
  Serial.print("Look Left");
  servo_motor.write(170);
  delay(500);
  int distance = readPing();
  delay(100);
  servo_motor.write(115);
  return distance;
  delay(100);
}

int readPing(){
  delay(70);
  int cm = sonar.ping_cm();
  if (cm==0){
    cm=500;
  }
  return cm;

}

void moveStop(){
  Serial.print("Stop");

  digitalWrite(in3, LOW);
  digitalWrite(in1, LOW);
  digitalWrite(in4, LOW);
  digitalWrite(in2, LOW);
}

void moveForward(){

  //if(!goesForward){

    //goesForward=true;

    Serial.print("Forward");

    digitalWrite(in1, HIGH);
    digitalWrite(in3, HIGH);

    digitalWrite(in2, LOW);
    digitalWrite(in4, LOW);

    analogWrite(enA, 250);
    analogWrite(enB, 250);

  //}
}

void moveBackward(){

  //goesForward=false;

  Serial.print("Backward");

  digitalWrite(in2, HIGH);
  digitalWrite(in4, HIGH);

  digitalWrite(in1, LOW);
  digitalWrite(in3, LOW);

}

void turnRight(){
  Serial.print("Right");

  digitalWrite(in1, HIGH);
  digitalWrite(in4, HIGH);

  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);

  delay(200);

  digitalWrite(in1, HIGH);
  digitalWrite(in3, HIGH);

  digitalWrite(in2, LOW);
  digitalWrite(in4, LOW);

}

void turnLeft(){
  Serial.print("Left");

  digitalWrite(in2, HIGH);
  digitalWrite(in3, HIGH);

  digitalWrite(in1, LOW);
  digitalWrite(in4, LOW);

  delay(200);

  digitalWrite(in1, HIGH);
  digitalWrite(in3, HIGH);

  digitalWrite(in2, LOW);
  digitalWrite(in4, LOW);
}

According to the Servo reference page it's not possible to use Servo library and PWM outputs on the pins 9 and 10.

On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.

Thank you so much for your input. I will try to use other PWM pins on the arduino uno board. I'll update if it works.

@JayZapanta You can only hope that NewPing library doesn't affect Timer2, as Servo library affects Timer1


text:
Turn on each of the LEDs in order, by setting the cycle delay to 100 milliseconds
I have a tutorial to finish and I don't know the code I have to use to make all (4 LEDs) to turn on in order. So this is my code and my simulation. Thanks in advance!

My Code:
void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(6, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(6, HIGH);
  delay(100); // Wait for 100 millisecond(s)

  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(9, LOW);
  digitalWrite(6, LOW);
  delay(100); // Wait for 100 millisecond(s)
}

EDITED:
I have to follow this one. I guess my simulator is correct.

you have the LEDs  really connected like on your fritzing schema? 5V to 5V pin

That wiring diagram (I refuse to call those things schematics) makes no sense to me at all. You have two LEDs in parallel, in series with two resistors that are also in parallel, and that chain is connected to two IO pins in parallel. And then you have it duplicated. The best you could hope for is turning on the LEDs in pairs. At worst, you will break the Arduino.

@Majenko, they are not in parallel. only the black wire is connected to 5V instead of ground (and uses red rail on the breadboard).

@Juraj You forget the metal strips in the breadboard... those LEDs are in parallel pairs, and the resistors are in parallel pairs.

@Majenko, true, Sorry, I am confused by this ugly fritzing

@Juraj Yeah. It's a ghastly toy but Arduino users seem to like it...

@Majenko I have edited my post. as you can see, that is the figure that I need to make.

I have a tutorial to finish ... did you do the tutorials that came before this? ... it appears that there is something that you did not understand about those tutorials ... you really need to identify what you do not understand, because it will affect your ability to write programs in the future

I see in your second diagram that you are controlling the ground side of the LEDs. digitalWrite(PinNumber, HIGH) will turn an LED OFF, digitalWrite(PinNumber, LOW) will turn an LED ON. Using delay() in a sketch should be avoided.
void setup(){
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(6, OUTPUT);
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(6, HIGH);
}

void loop(){
  digitalWrite(13, LOW);
  delay(100);
  digitalWrite(12, LOW);
  delay(100);
  digitalWrite(9, LOW);
  delay(100);
  digitalWrite(6, LOW);
  delay(100);
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(6, HIGH);
  delay(100);
}

Your code switches them all ON and OFF simultaneously.
What I read from your question is you want to turn them on in order.
In this case, use a simple state diagram. This means you have to create variable (preferably an enumeration), e.g.:
enum EState { FIRST_ON, SECOND_ON, THIRD_ON, FOURTH_ON };

EState _state;

You can better use better names than FIRST_ON, ..., but I do not know what your lights mean.
In the setup, you initialize _state, e.g.
_state = FIRST_ON;

Than in the loop you check and change the state:
switch (_state)
{
case FIRST_ON:
    digitalWrite(13, HIGH); // Assuming this is the first light
    digitalWrite(12, LOW); // Put the others off
    ...
    ...
    _state = SECOND_ON; // Set the next state
    break;

case SECOND_ON:
    digitalWrite(13, LOW); // Assuming this is the first light
    digitalWrite(12, HIGH); // Put the second LED on
    .. // Put the third/fourth off
    _state = THIRD_ON; // Set the next state
    break;

    // Do the same for THIRD_ON and FOURTH_ON

default: // in all other cases
     break; // Should not happen
}

delay(100: // Wait for 100 milliseconds

Note, to not complicate the example, I've written out (mostly) the lines like you:
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(9, HIGH);
digitalWrite(6, HIGH);

However, since these are almost copies (4 in the state diagram), it is best to write a separate function:
void SwitchLedsOn(int led1State, int led2State, int led3State, int led4State)
{
  digitalWrite(13, led1State);
  digitalWrite(12, led2State);
  digitalWrite(9, led3State);
  digitalWrite(6, led4State);
}

Now you can use in the first state case:
case FIRST_ON:
    SwitchLedsOn(HIGH, LOW, LOW, LOW); // Switch only first on
    break;

And do similar with the other states.

really? a state machine for this beginer? http://www.smart-jokes.org/programmer-evolution.html

are you sure that is for beginner cause my subject is something like beginner for arduino

It's not for beginner's true. However, the concept is so useful, that even for beginner's it is good to know it exists. Maybe they can read this answer at a later stage.

add this to loop() end
 digitalWrite(13, HIGH);
 delay(100);
 digitalWrite(12, HIGH);
 delay(100);
 digitalWrite(9, HIGH);
 delay(100);


text:
Designing around Output pin limitations
I'm new to Arduino and am working on a project with my son.  We are using the LillyPad USB board (schematic) to drive a bunch of LEDs (LED Datasheet).  Our project is based loosely off of the 'Turn Signal Biking Jacket'.
Our project calls for 7-11 LEDs in parallel on a single circuit.  In the 'Turn Signal' project the LEDs are driven off of a pair of output pins (1 HIGH and 1 LOW).  In a circuit that looks like this...

simulate this circuit – Schematic created using CircuitLab
Is this ideal?  Would it make more sense to connect the LED-chain to Vcc and have the return line connected to a single output set to LOW (to turn on the lights)?
If we were to have 3-4 of these LED-chains on at once, do I have to be concerned with total draw on the microcontroller?
Help? Thoughts?

Why are you using 2 digital pins for 1 output? Instead of writing LOW to one pin, you can wire the leds to GND directly, so that the current doesn't have to flow back into your digital pin hardware and you are saving an extra pin. (In his answer Majenko also wires them to GND)

@chrisl That was my thought as well.  That's how it is drawn up in the original 'Turn Signal' project.

If you know the forward voltage of the LEDs you can easily do some calculations.
For a typical red LED the forward voltage is around 2V.  Other colours vary.  So we can work out that, at 5V supply, each LED with its own 150R resistor, would take:
     V    5-2
I = --- = --- = 20mA
     R    150

With 11 LEDs in parallel on at once that would be 0.02 * 11 = 220mA.
That is far more than the 25mA an IO pin is able to supply, so you will damage the Arduino doing it like that.
Instead you will need to switch each chain of LEDs with a transistor of some form.  I'd choose a logic-level N-channel MOSFET as a "low-side" switch:

simulate this circuit – Schematic created using CircuitLab
Now your Arduino doesn't care about the current - all it sees is the MOSFET.
If your LED forward voltages are less than 2.5V you can also chain them together to halve the current:

simulate this circuit
Since the forward voltage is now double you use a smaller resistance to set the current (R=V/I, where V is 5-2Vf).

if I'm reading the datasheet correct, the forward voltage is 'typically' 3.3v 'max' 4.0v.  I'll add a link to my Question.  Also, Vbattery should be 3.7V as that's the output from the Lithium Battery.  And, I think, Vcc is 3.3v (I'll update the question with the datasheets)

So you won't be able to double them up then.

Using your math with the updated datasheet info (Vbatt = 3.7V, Vf = 3.3v), I get 3.7-3.3/150 = 3.33mA per LED.  Or 37mA for 11.  That is still more than the 25mA per pin.  How does the ~120Ohms of thread resistance figure in?  That would lower the voltage (slightly) and thus the voltage drop across the LED, right?

Yep. you would probably just get away with 11 LEDs. The absolute max for a Io pin is 40mA.

And if we keep the LED count to 9 we'd have a bit more room.  Thanks.

Yup. Or if you want more just split it between two pins as two separate chains.


text:
Arduino with Ultrasonic sensor integrated but vibration motor not working according to the code
Here's my code after editing the measurement had error. Now the ultrasonic measurement is working but the vibration motor is not vibrating.
#define trigPin1 8
#define echoPin1 7
#define motorPin1 13

long duration, distance, UltraSensor;

void setup()
{
  Serial.begin(9600); // to use the serial monitor.
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  //pinMode(motorPin1, OUTPUT);

}

void SonarSensor(int trigPin, int echoPin)
{
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;
  delay(100);
}

void loop()
{
  SonarSensor(trigPin1, echoPin1);
  UltraSensor = distance;
  Serial.print(distance); // print out the distance on Serial Monitor
  Serial.println("cm");
//
  if (distance <= 60 && distance >= 45) // Checking the distance, you can change the value
  {
    digitalWrite(motorPin1, HIGH); // motor on
    delay(200);
    digitalWrite(motorPin1, LOW); // motor off
    delay(200);
  }
  else if(distance < 45 && distance >=30)
  {
    digitalWrite(motorPin1, HIGH); // when greater than 100cm
    delay(100);
    digitalWrite(motorPin1, LOW);
    delay(100);
  }
  else if(distance < 30)
  {
   digitalWrite(motorPin1, HIGH);
   delay(50);
   digitalWrite(motorPin1, LOW);
   delay(50);
  }
  else
  {
    digitalWrite(motorPin1, LOW);
  }
}

Cut out everything from your sketch except the distance measuring. Forget the rest for now. Get the distance measuring working first.

And while you are at it, disconnect the motor and post a picture clearly showing how you have the ultrasonic sensor wired to the arduino.

After i cut out everything except the distance measuring part also not working. You can check below. Sorry for inconvenience

do not put updates into comments ... update the original question ... there is an edit button for doing that ... while you are at it, change the title of your question to Arduino not measuring distance correctly, because that is the problem, it is not a motor problem.

I already edited my code and now the measurement is working but the motor is not vibrating. Any help ?

I think you have to uncomment the line that defines the motor as an output device.
//pinMode(motorPin1, OUTPUT);


text:
Create a sketch that allows me to run a DC motor and LED sequence at the same time
I need a program created that will both run a DC motor and an LED sequence at the same time. The image is what the DC motor code should do.
/*
-==:: 3 Volts DC Motor Driver with Dual 555 Timer IC ::==-
  * Control Pin from 555 IC is needed to STOP the motor
  * Trigger Pin from 555 IC is needed to drive forward or backward
  * PWM on Trigger Pin is used to set the speed
  * Note : Forward and Backward is interchangeable via Motor connection.
 */

int controlPin = 2; // 555 pinout 5
int triggerPin = 3; // 555 pinout 2

// the setup routine runs once when you press reset:

void setup()  {
  pinMode(controlPin, OUTPUT);
  pinMode(triggerPin, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop()  {
//  move FORWARD;
    digitalWrite(controlPin, HIGH);
    digitalWrite(triggerPin, HIGH); //full speed
    delay(3000);
//    PWM testing to control motor speed
//    analogWrite(triggerPin, 128+70); //minimum speed (128+70)
//    delay(3000);

//  STOP;
    digitalWrite(controlPin, LOW);
    digitalWrite(triggerPin, HIGH);
    delay(3000);

//  move BACKWARD;
    digitalWrite(controlPin, HIGH);
    digitalWrite(triggerPin, LOW); //full speed
    delay(3000);

//    PWM testing to control motor speed

//    analogWrite(triggerPin, 128-70); //minimum speed (128-70)
//    delay(3000);

//  STOP;
    digitalWrite(controlPin, LOW);
    digitalWrite(triggerPin, HIGH);
    delay(3000);
}

As for the LED code I have no idea. I just found this code on the web. The important thing is that the codes execute at the same time continuously.

an arduino always runs any program sequentially. ... it's just that it does it so fast, that it looks like it does it at the same time

I edited the post. I understand that, but what I need is that it continuously runs both things at once... run a dc motor and LED chain.

As for the LED code I have no idea ... what should the LED do? ... you need to have that clearly in your mind, otherwise you cannot write the code

do not post a picture of your code ... you will not find anybody that is willing to type it into their computer for testing purposes .... put your original text back into your question and format it as code

Posting pictures of the code is counter productive!

Edit... Sorry about that didn't think it through. As for the LED I just need them to blink randomly or in an order if its needed. About ten LEDs of different colours.

Have you tried anything to solve this yourself? We are not a free code writing service.

As stated in the comments, the Arduino can only execute 1 command at a time. There is no real multi-threading on this hardware. But you can to the work in sequence so fast, that you won't notice the difference with motors or LEDs. Here it is important to use non-blocking code, which doesn't block the execution of other code, when it is only waiting (the delay() function is just busy waiting).
For doing anything non-blocking (as setting LEDs or changing the state of a motor) you can use the millis() function. Refer to the BlinkWithoutDelay example from the Arduino IDE. For a very simple sequence (as blinking) you can directly use the code from the example. Basically you use a timestamp, which holds the last time, the blink code was executed. On every iteration of the loop() function you check, if a certain time has passed since the timestamp have been taken. If so, execute the code again and update the timestamp:
unsigned long timestamp=0;
void loop(){
  if(millis()-timestamp > 500){
    digitalWrite(led_pin,!digitalRead(led_pin));
    timestamp = millis();
  }
}

This code would toggle the led_pin each 500ms.
For coding complex sequences you can make a state machine. For this you create a numeric state variable. In the loop() function you use a switch-case-statement, to execute the right code for each state of your programm. Also directly in the loop() function you change the state variable depending on the time through the above code. This would look somewhat like this:
int state = 0;
unsigned long timestamp = 0;
void loop(){
  if(millis() - timestamp > 1000){
    state++;
    timestamp = millis();
  }

  switch(state){
    case 0:
      digitalWrite(led_pin,!digitalRead(led_pin));
      //  move FORWARD;
      digitalWrite(controlPin, HIGH);
      digitalWrite(triggerPin, HIGH); //full speed
      break;
    case 1:
    case 2:
      digitalWrite(led_pin,!digitalRead(led_pin));
      break;
    case 3:
      digitalWrite(led_pin,!digitalRead(led_pin));
      // stop moving
      digitalWrite(controlPin, LOW);
      digitalWrite(triggerPin, HIGH);
      break;
    case 4:
    case 5:
      digitalWrite(led_pin,!digitalRead(led_pin));
      break;
    case 6:
      digitalWrite(led_pin,!digitalRead(led_pin));
      //  move BACKWARD;
      digitalWrite(controlPin, HIGH);
      digitalWrite(triggerPin, LOW); //full speed
      break;
    case 7:
    case 8:
      digitalWrite(led_pin,!digitalRead(led_pin));
      break;
    case 9:
      digitalWrite(led_pin,!digitalRead(led_pin));
      // stop moving
      digitalWrite(controlPin, LOW);
      digitalWrite(triggerPin, HIGH);
      break;
    case 10:
    case 11:
      digitalWrite(led_pin,!digitalRead(led_pin));
      break;
    case 12:
      state = 0;
      break;
  }
}

This code would toggle the led_pin every second and also doing the moto sequence 3s forward, 3s stop, 3s backwards, 3s stop. This sequence loops forever.
When you only want to let the led blink continuously, it would be easier to exclude this part of the code from the state machine, but I wanted to show how this principle would work (for example if you want to include a complex blinking sequence).

I TRIED TO USE THIS CODE BUT AN ERROR SAYS LED_PIN WAS NOT DECLARED IN THIS SCOPE... HAVE ANY IDEA WHAT THAT MEANS?

Yes, I didn't put in the trivial stuff, because I just wanted to show the working principle. For toggling a pin, you have to define the pin somewhere (for example as global variable). Put in the pin you use for the LED. Also you have to set the pinMode to OUTPUT for this pin in your setup function.     And also don't forget your shift-lock, since you don't have to yell at me :D

Okay thank you. That helps some, im really new to this language and I am trying to build a DIY project fr an event on Friday. I really don't like to pull all this info out from you, but id greatly appreciate it.

Oh yeah sorry about that!

You should read some basic tutorial for Arduino. Also refer to the Blink example from the Arduino IDE. For working further with Arduino you should fully understand, what each command there does, since that are basics (dealing with digital or analog output/input is really important)   And if my answer is good, you may choose it as correct :D

ahh lol I don't have time... :(


text:
Array, hexadecimal and serial write
I am trying to write a pice of code which send to a receiver the frequency to listen.
As per its documentation, it should receive the following sequence:

Example with 123.456 MHz
Command to send (frequency converted in 4 bytes, followed by 2 instruction bytes
0x12 0x23 0x56 0x00 0x01

To be able to memorize six frequencies, I fill an array:
uint32_t mem_freq[6] = {
   0x121050,
   0x126500,
   0x120500,
   0x121700,
   0x121825,
   0x118700,
};

My concern is that when I do :
Serial.write(mem_freq[mem_index]);
//Serial.write(0x00);
//Serial.write(0x01);

Only 1 byte is sent, and it's hard to debug as the serial console displays only ascii characters.
When I use Serial.print instead, mem_freq[2] shows correctly 0x120500
After Majenko's answer, I tried this:
Serial.print(0x123456 >> 16,HEX);
Serial.print(0x123456 >> 8,HEX);
Serial.print(0x123456,HEX);
Serial.print(0x00,HEX);
Serial.print(0x01,HEX);

And it outputs:

12123412345601

Is this normal ?

use Serial.print(value, HEX) to print on Serial Monitor in hex form https://www.arduino.cc/reference/en/language/functions/communication/serial/print/

encoding 123.456 as 0x12 0x23 0x56 is very exotic. how do you use the frequency? I would send it as decimal number 123456. It fits into uint32_t

@Juraj, i think that the receiver hardware uses BCD and requires the above mentioned byte stream for correct operation

You need to manually split your values into bytes. You can either do that by storing them as individual bytes (as shown by Ignacio), or by using bit shifting:
Serial.write(mem_freq[mem_index] >> 16);
Serial.write(mem_freq[mem_index] >> 8);
Serial.write(mem_freq[mem_index]);

That sends the bits 16-23 (0x12) then bits 8-15 (0x10) followed by bits 0-7 (0x50).

Thanks Majenko. I have edited my post to show the result in ascii, and it is strange...

Since you have switched from write to print it can now print the entire number every time. If you want to print it you should also mask the value with & 0xFF.

Serial.print((0x123456 >> 16) & 0xFF,HEX);

That's because you need to use an array of arrays, and send three bytes.
uint32_t mem_freq[6][3] = {
  {0x12, 0x10, 0x50},
   ...
};

 ...
  Serial.write(mem_freq[mem_index], 3);
 ...


text:
Changing outputs infinitely for no reason
Im a student and working on a arduino project for IoT competition and me and my team have built a house and I made this code below.
For some reason when I upload it to my Arduino MKR1000 it constantly turns D6 and D8 on and right after their both on it turns them off and so on for ever. I cant figure out why is it doing that because its only these 2 but not the rest of them.
Quick help would be appreciated.
Please note that I'm by any means a PRO at this but I do know my share about programming.
        //Definiramo ispis na serial port
#define BLYNK_PRINT Serial

//Ucitavamo biblioteke
#include <SPI.h>
#include <WiFi101.h>
#include <BlynkSimpleMKR1000.h>

// Autorizacijski kod za aplikaciju Blynk
char auth[] = "Token";

// Podatci za WiFi
char ssid[] = "SSID";
char pass[] = "PASSWORD";

// ----- Inicializacija ledica -----
const int ledBorDim = 2;
const int ledKuh = 6;
const int ledTrp = 7;
const int ledKup = 8;
const int lediceUlaz = 9;
const int ledSpav = 10;

// ----- Inicializacija gumbova -----
const int gumbKuh = 11;
const int gumbKup = 12;
const int gumbSpav = 13;
const int gumbBor = 14;

// ----- Kontrolne varijable -----
int stanjeLedKuh = 0;
int stanjeLedKup = 0;
int stanjeLedBor = 0;
int stanjeLedSpav = 0;

int gumbStanjeKuh = 0;
int gumbStanjeSpav = 0;
int gumbStanjeBor = 0;
int gumbStanjeKup = 0;

//Led kuhinja
BLYNK_WRITE(V3)
{
  int pinValue = param.asInt(); //Pinvalue postavljamo da bude vrijednost ono sto postavimo na aplikaciji
  Serial.print("ledKuh = "); //Ispis na ekran trenutno stanje
  Serial.println(pinValue);
  if (pinValue == 1)
  {
    digitalWrite(ledKuh, HIGH);
    stanjeLedKuh = 1;
  } if (pinValue == 0)
  {
    digitalWrite(ledKuh, LOW);
    stanjeLedKuh = 0;
  }
}

//Ledica za kupaonicu
BLYNK_WRITE(V5)
{
  int pinValue = param.asInt(); //Pinvalue postavljamo da bude vrijednost ono sto postavimo na aplikaciji
  Serial.print("ledKup = "); //Ispis na ekran trenutno stanje
  Serial.println(pinValue);
  if (pinValue == 1)
  {
    digitalWrite(ledKup, HIGH); //Promjena stanja na izlazu arduina
    stanjeLedKup = 1;
  } if (pinValue == 0)
  {
    digitalWrite(ledKup, LOW); //Promjena stanja na izlazu arduina
    stanjeLedKup = 0;
  }
}

//Paralelni spoj ledica na ulazu
BLYNK_WRITE(V6)
{
  int pinValue = param.asInt(); //Pinvalue postavljamo da bude vrijednost ono sto postavimo na aplikaciji
  Serial.print("lediceUlaz = "); //Ispis na ekran trenutno stanje
  Serial.println(pinValue);
  if (pinValue == 1)
  {
    digitalWrite(lediceUlaz, HIGH); //Promjena stanja na izlazu arduina
  } if (pinValue == 0)
  {
    digitalWrite(lediceUlaz, LOW); //Promjena stanja na izlazu arduina
  }
}

//Dimmer za Boravak
BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); //Ucitamo vrijednost
  Serial.print("Dimmer vrijednost: "); //Ispisemo na serial
  Serial.println(pinValue);
  analogWrite(ledBorDim, pinValue); //Na izlaz postavljamo vrijednost
  if (pinValue == 0)
  {
    Blynk.virtualWrite(V50, 1);
    stanjeLedBor = 0;
  } else if (pinValue > 0)
  {
    Blynk.virtualWrite(V50, 0);
    stanjeLedBor = 1;
  }
}

BLYNK_WRITE(V50)
{
  int pinValue = param.asInt();
  if (pinValue == 1)
  {
    analogWrite(ledBorDim, 255);
    Blynk.virtualWrite(V1, 255);
    stanjeLedBor = 1;
  } if (pinValue == 0)
  {
    digitalWrite(ledBorDim, LOW);
    Blynk.virtualWrite(V1, 0);
    stanjeLedBor = 0;
  }
}

void gumbKuhinja()
{
  gumbStanjeKuh = digitalRead(gumbKuh);
  if (gumbStanjeKuh == LOW)
  {
    if(stanjeLedKuh == 1)
    {
      digitalWrite(ledKuh, LOW);
      Blynk.virtualWrite(V3, 0);
      Serial.println("Ledica na V3/D6 je LOW");
      stanjeLedKuh = 0;

    } else if (stanjeLedKuh == 0)
    {
      digitalWrite(ledKuh, HIGH);
      Blynk.virtualWrite(V3, 1);
      Serial.println("Ledica na V3/D6 je HIGH");
      stanjeLedKuh = 1;

    }
    delay(500);
  }
}

void gumbKupaonica()
{
  gumbStanjeKup = digitalRead(gumbKup);
  if (gumbStanjeKup == LOW)
  {
    if(stanjeLedKup == 1)
    {
      digitalWrite(ledKup, LOW);
      Blynk.virtualWrite(V5, 0);
      Serial.println("Ledica na V5/D8 je LOW");
      stanjeLedKup = 0;

    } else if (stanjeLedKup == 0)
    {
      digitalWrite(ledKup, HIGH);
      Blynk.virtualWrite(V5, 1);
      Serial.println("Ledica na V5/D8 je HIGH");
      stanjeLedKup = 1;
    }
    delay(500);
  }
}

void gumbSpavaca()
{
  gumbStanjeSpav = digitalRead(gumbSpav);
  if (gumbStanjeSpav == LOW)
  {
    if(stanjeLedSpav == 1)
    {
      digitalWrite(ledSpav, LOW);
      Blynk.virtualWrite(V6, 0);
      Serial.println("Ledica na V6/D10 je LOW");
      stanjeLedSpav = 0;
    } else if (stanjeLedSpav == 0)
    {
      digitalWrite(ledSpav, HIGH);
      Blynk.virtualWrite(V6, 1);
      Serial.println("Ledica na V6/D10 je HIGH");
      stanjeLedSpav = 1;
    }
    delay(500);
  }
}

void gumbBoravak()
{
  gumbStanjeBor = digitalRead(gumbBor);
  if (gumbStanjeBor == LOW)
  {
    if(stanjeLedBor == 1)
    {
      analogWrite(ledBorDim, 0);
      Blynk.virtualWrite(V1, 0);
      Serial.println("Ledica na V1/D2 je 0");
      stanjeLedBor = 0;
    } else if (stanjeLedBor == 0)
    {
      analogWrite(ledBorDim, 255);
      Blynk.virtualWrite(V1, 1);
      Serial.println("Ledica na V1/D2 je 255");
      stanjeLedBor = 1;
    }
    delay(500);
  }
}

void setup()
{

  pinMode(ledBorDim, OUTPUT);
  pinMode(ledKuh, OUTPUT);
  pinMode(ledKup, OUTPUT);
  pinMode(lediceUlaz, OUTPUT);
  pinMode(ledSpav, OUTPUT);

  pinMode(gumbKuh, INPUT);
  pinMode(gumbKup, INPUT);
  pinMode(gumbSpav, INPUT);
  pinMode(gumbBor, INPUT);

  // Debug console
  Serial.begin(9600);
  //Povezivanje na WiFi i na aplikaciju Blynk
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
  gumbKuhinja();
  gumbKupaonica();
  gumbSpavaca();
  gumbBoravak();
}

Serial outpout:
Ledica na V6/D10 je HIGH
Ledica na V1/D2 je 255
Ledica na V6/D10 je LOW
Ledica na V1/D2 je 0
Ledica na V6/D10 je HIGH
Ledica na V1/D2 je 255
Ledica na V6/D10 je LOW
Ledica na V1/D2 je 0
Ledica na V6/D10 je HIGH
Ledica na V1/D2 je 255
Ledica na V6/D10 je LOW
Ledica na V1/D2 je 0
Ledica na V6/D10 je HIGH
Ledica na V1/D2 je 255

Little label reading D14 means that that pin isnt suppoast to go to D4 but to D14 of the MKR1000 but since i dont have that board in the program im stuck with arduino Uno.
Short explanation of the code...
We build a house out of styrofoam and placed 6 Led's around and almost all can be controlled from the Blynk app on my device. Also there are 4 buttons controlling 4 Led's. I have it setup so that when i press a button it changes the state of a particular LED and then sets the appropriate value on the app (If LED is on then set app value to 1). Pretty much that that about this code. Sorry if you cant understand but I had to write it in my native language since this is going to be a compettition and I was told that they wouldn't like if the code was in english for some reason.

pinMode(gumbKuh, INPUT); what's connected this pin, a button? with external pullup/pulldown? The repeadetly called function could flip the D6 pin in gumbKuhinja() when is D11 oscillating.. Do you also get any serial output when the pin toggles?

Let me upload a quick schematic so you could see better.

But yes it is a button.

Can you try changing all the pinMode(x, INPUT) lines to pinMode(x, INPUT_PULLUP) and change your program logic to "if the pin is LOW, the button is pressed and we must do something" (if it isn't already)? Without a pullup or pulldown on the buttons they will randomly read noise (like an antenna) which might trigger your logic to toggle the pin.

Oooohhh, very clever, i didnt think of that!
Ill try it right away.
But, wouldn't that affect the code? Because i want the light to toggle only when i press the button.

No change. When i set it to INPUT_PULLUP it just blinks slower. Dont't think i metioned buy i have NOTHING else but a LED and 200Ohm resistor connected to the board and its blinking.

In all your functions like gumbKuhinja, gumbBoravak and gumbBoravak you need to change the first if statement from if( .. == HIGH) to if( .. == LOW) since the button is low-active (LOW when pressed, normally HIGH when unpressed). You can edit your question to include your new code.

Still the same but now instead of D6 and D8 its now V1/D2 and V6/D10

KEEP IN MIND that i have nothing connected to the arduino. Im monitring it trough the serial monitor.

Your new code still has INPUT instead of INPUT_PULLUP. With pulled up pins and checking if the pin LOW, nothing should happen if you have nothing connected. Please try https://pastebin.com/zYESFnSU . If that does not work start a new sketch with minimal code in which you only try to toggle the LED by button press and nothing else, to track down the problem.

Its no longer blinking randomly but now my buttons donw work. I tried shorting 5V and pin 11 and nothing happend.

Tried minimalist code. This is the one I used when i was figuring out how to toggle buttons.
https://pastebin.com/esTESF3j

This comment section is getting rather messy. With your minimal test code, did you try to short the button pin, which is D8, to GND to trigger it? Work on getting the "toggle LED by button press" working (follow https://www.arduino.cc/en/Tutorial/InputPullupSerial) first, then re-integrate code. If you are unsure on what voltage level a pin is, use a multimeter.

I would appreciate if you would now post your answer as a answer because you just solved my problem good sir.
Just to elaborate. Now sisnce im using INPUT_PULLUP in need to connect lets say pin 11 to GND for the code activate ledKuh?
Because that's how I did it now and it works prefectly.

You had the following general problem:
The code you were using was configuring a pin into INPUT mode and reading the value on it. On this pin you conencted a button without extern pullup or pulldown resistor. This means that if the button is not pressed, it is not connected to anything and thus a floating pin. You cannot realibly read the value of the floating pin, as its voltage level may be on pretty much anything. It picks up interference like an antenna.
To solve this the button pin must be pulled to known voltage level if it is not connected (aka button is not pressed). We achieve this by using a resistor which is on one end connected to the button pin and on the other end connected to either VCC (+5V) or GND (0V). This has the effect that when the button is not pressed, the resistor pulls the voltage level of this pin up (if connected to VCC), or down if connected to GND.
We can either attach a resistor (e.g. 10K Ohm) in the circuit or active the internal (weak) pull-up resistors in our microcontroller. In Arduino, this is achieved by using pinMode( buttonPin, INPUT_PULLUP).

In this circuit with INPUT_PULLUP on D2, we have:

if the button is not pressed down, no connection to GND is made. The activated pull-up resistor will pull the voltage level of D2 to HIGH
if the button is pressed down, it makes a connection to GND and overrides the pullup resistor. Pin D2 now reads LOW.

The logic can of course also be inverted -- you can use a PULLDOWN resistor and instead of connecting the button to GND on the other side connect it do 5V. This make the button read LOW when unpressed and HIGH pressed.
So the modified code must be changed from
  pinMode(gumbKuh, INPUT);
  pinMode(gumbKup, INPUT);
  pinMode(gumbSpav, INPUT);
  pinMode(gumbBor, INPUT);

to
  pinMode(gumbKuh, INPUT_PULLUP);
  pinMode(gumbKup, INPUT_PULLUP);
  pinMode(gumbSpav, INPUT_PULLUP);
  pinMode(gumbBor, INPUT_PULLUP);

and the logic which detects a button pressed must be changed to trigger an action when the pin is LOW (because a PULLUP is used, button reads LOW when pressed, HIGH else).
So from code of the form
void gumbBoravak()
{
  gumbStanjeBor = digitalRead(gumbBor);
  if (gumbStanjeBor == HIGH)
  {
    /* LED toggling and debouncing */
    delay(500);
  }
}

To
void gumbBoravak()
{
  gumbStanjeBor = digitalRead(gumbBor);
  if (gumbStanjeBor == LOW)
  {
    /* LED toggling and debouncing */
    delay(500);
  }
}

Also I recommend you to watch this youtube video to learn more about floating pins and pullup/pulldown resistors: Pull up Resistor Tutorial


text:
A SoftwareSerial library for SAMD boards
So I've got three boards that I'm using to test this (modified) code:
int sensor1Pin = A0;
int sensor2Pin = A1;
int sensor3Pin = A2;

float sensors[] = {0,0,0};

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

void loop(){

sensors[0] = analogRead(sensor1Pin);
sensors[1] = analogRead(sensor2Pin);
sensors[2] = analogRead(sensor3Pin);

Serial.print(sensors[0]);
Serial.print(",");
Serial.print(sensors[1]);
Serial.print(",");
Serial.println(sensors[1]);
}

An Uno, a Feather M0, and an MKR1000.
The code will only work on the Uno because it's AVR-based whereas the other two boards are SAMD. When running on a feather, you get this error:
/home/ghylama/Arduino/libraries/SoftwareSerial_master/SoftwareSerial.cpp:260:2: error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
     #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors

However, the resolution of the Uno is too low for my purposes (its DAC has a resolution of 10, whereas I need a resolution of 12, minimum). Are there any libraries/workarounds that I can use for this purpose?
I've tried SoftwareSerial, NeoSWSerial, and this one.

Sorry I'm confused, what exactly is the question? How to add Serial (/UART) ports to your Feather M0? Or about the DAC? You are using analogRead here though, which uses the ADC.

What has serial to do with DAC (ADC?) resolution?

Sorry if my wording was unclear but I've been at this for a while now so I've got tunnel vision.
Running this code on a feather gives this error:
Arduino/libraries/SoftwareSerial_master/SoftwareSerial.cpp:260:2:error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
#error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
Thing is, I can run this on an Uno without issues but I want it on a feather. The DAC has nothing to do with serial but that is my constraint. I need a library that does the same job as SoftwareSerial but for M0.

Why do you need software serial?  An ARM part will typically have multiple hardware serial ports.

@gre_gor Serial has nothing to do with that. My problem is that I am trying to get the SoftwareSerial library to run on devices it was not designed for. I need it to run on a device with a higher DAC resolution (Duo, Zero, Feather).

@ChrisStratton I am trying to save data from three sensors to an excel sheet. I wanted to do this by using Processing + Arduino IDE with the code from this link: http://www.hackerscapes.com/2014/11/how-to-save-data-from-arduino-to-a-csv-file-using-processing/
Is there a better way?

That has nothing to do with software serial, any serial implementation should work.  Software serial is a hack to deal with the fact that the classic Arduino only has 1 port.

@ChrisStratton It's there in the original Arduino code, line 27. Seemed pretty important so I left it in. So that example would work without it?

No, it has nothing to do with the algorithm, and everything to do with the limitations of the ATmega328p.  Which you are not using.  If you're going to run programs you don't understand, and argue with the people who explain them to you, then you need to stick to doing things exactly as described, without trying to run them on alternate hardware.

@ChrisStratton I'm not arguing, I just want to understand what is seemingly obvious to everyone else. Sorry if it came off that way. Now that you explained what software serial is, i get it. So since the only use for that library is as a fix for a limitation, i'm removing that line.

I will restate the problem as I have understood it: You want more Serial objects, aka more UART ports.
On your Adafruit Feather M0 with its SAMD21G18 Cortex-M0+ MCU, you have six SERCOM peripherals which you can arbitrarily configure to be a UART, I2C or SPI port. Each peripheral can have its connections routed to several different pins on the board. It is a very versatile piece of hardware.
Don't use a SoftwareSerial library made for AVR MCUs when you have the hardware. Adafruit's guide shows how you can reconfigure those SERCOMs to get additional Serial objects.
https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports?view=all#creating-a-new-serial