text:
How to document a custom library in Arduino
I have created my own library and it is working flawlessly. Now I want to add some documentation to it that the Arduino IDE can understand.
For the functions from the Arduino IDE itself like delay(ms) you can right click them and then select Find in Reference. How can I add this feature to my own library?

I uv your question because I'm also interested to know if that is possible at all. As far as I know the REFERENCE_LINK is a link to Arduinos own main reference. Libs can only have an extra folder to put docs into it, but that is completely ignored by the IDE.

OK, time for my most comprehensive answer on StackExchange so far (tanks to @Juraj for helping out with this).
To demonstrate all the steps needed for this, this answer will use an example library that will be called Foo.
Here we go:
To add documentation to your library that the Arduino IDE can work with, you first need to place your library in the correct directory. Thats either in your library folder in your sketchbook folder (you can locate it by selecting File>Preferences>Sketchbook location, by default this is
C:\Users\YourUsername\Documents\Arduino\libraries

or
InstallationDirectoryOfYourIDE\portable\sketchbook\libraries

if you are using a portable installation) or in
InstallationDirectoryOfYourIDE\libraries

In which of the two places you put your library is up to you, both work (except if you put in both places at the same time). You should keep this in mind though: If you put your library in the libraries folder of your sketchbook, only you will have access to that library. If there are other users on the same PC that shall be able to use your library, you have to put in in the general libraries folder (if you don't have access to that folder because it belongs to another user and you are not the admin, then too bad, sorry ;).
Your library has to contain at least a file Foo.h which can be located directly in the folder of your library (old standard) or in a subfolder src in your library folder (up to date standard). What the file contains is for the sake of this example absolutely arbitrary (e.g. just leave it empty).
Next you need a valid library.properties file for your library. You can create and edit it with any text editor like notepad. This file has to be placed directly into the folder of the library.
Here is a bare minimum example for this file that works:

name=Foo
  version=1.0.0
  author=Your name
  maintainer=Your name
  sentence=Something
  paragraph=Whatever
  url=http://example.com

More information on how this file works (and other things to consider when creating a library) can be found at the Arduino Library Specification.
Now we can specify which words the IDE shall highlight and which of them shall link to which reference page (to make sure that this works in principle it is not necessary to create your own .html files yet). To do this, create a file keywords.txt in the folder of your library. In it you write something like this:
foo KEYWORD2    Foo

In this example foo is the keyword that will be highlighted in the IDE (and on right click present the option Find in Reference). KEYWORD2 specifies how exactly foo will be highlighted (colour, boldness, etc.), in this case it will appear like normal text in orange (once again, see the Arduino Library Specification for more details on this). Foo is the name of the .html file (without the extension) that is opened when you right click foo in the IDE and select Find in Reference. It has to be located in this folder:
InstallationDirectoryOfYourIDE\reference\www.arduino.cc\en\Reference

The three words are separated by true tabs (not multiple space characters). Before creating your own .html file you can just copy one of the files there and rename it to Foo. Note that your library doesn't have to contain anything else besides the three mentioned files and some file in the reference folder for this to work. At this point you should restart your IDE and check whether your keyword foo is highlighted and offers the option Find in Reference when you right click it. If so, success! You can now move on to create your own .html file to put in the reference folder.
You could start by just changing one of the existent files to fit the style of the Arduino API, but you could also create your entirely own files. The probably best option however is to write your library according to doxygen standards and then let doxygen do the work for you creating the file automatically.
Just one more thing to be mentioned: This method works for any keywords that are used in the way yourKeyword or something.yourKeyword, but not Something::yourKeyword (this is how you would use a static function or variable in your library). According to @Juraj this is something caused by the IDE. There is a workaround for this though: Replace each line in the keywords.txt file
yourKeyword KEYWORDX    ReferenceFile

with
yourKeyword KEYWORDX    ReferenceFile
YourLibrary::yourKeyword    KEYWORDX    ReferenceFile

This way yourKeyword will be highlighted as you would expect it but occurrences like YourLibrary::yourKeyword will also bring up the option Find in Reference when right clicked.
That's it for today. Thanks and bye bye!

Arduino uses the keyword.txt file to highlight words and to define a reference page to keywords. But the reference page must be in reference folder of IDE installation and the keyword.txt contains only a filename, not the path.

REFERENCE_LINK This field specifies the Arduino Language Reference page to open via Right Click > Find in Reference or Help > Find in Reference when the cursor is on that keyword. Generally it does not make sense to define the REFERENCE_LINK field for 3rd party library keywords since they are not likely to be in the Arduino Language Reference.

I have a library which implements WiFiClient and WiFiServer like the Arduino WiFi library, so I can link in keywords.txt to Arduino reference like this:
WiFiClient  KEYWORD2    WiFiClient
WiFiServer  KEYWORD2    WiFiServer
WiFiUDP     KEYWORD2    WiFiUDPConstructor

The names used are names of html files in Arduino\reference\www.arduino.cc\en\Reference.

the answer is that it is not possible

I updated the answer

the reference names in keyword.txt are names of html files located somewhere in reference folder

the keywords.txt must use tabs to separate the fields. did you restart IDE?

sorry, the file must be in C:\Program Files (x86)\Arduino\reference\www.arduino.cc\en\Reference

do you have the keywords.txt file in the library folder next to library.properties? does your library match the 1.5 library specification?

here it works. as soon as I put the third field in keyword.txt the "Find in reference" is enabled even if the file name is not valid. Now I see, that the text cursor must be on the word too.

the library is WiFiEspAT (in Library Manager), but I published it without keywords.txt. To test this answer I copied keywords.txt from Arduino WiFi library and added a line for beginAP which doesn't exist in Arduino WiFi library. and I added the reference file to the Reference folder

This library works. What do I have to do for my own library to work like this? Could you please provide a minimal example for a custom library?

https://github.com/jandrassy/lab/tree/master/Foo

I just found out something very interesting. When writing the keywords from my library in the IDE just by themselves or in the form something.keyword it works as intended. But if I write them in the form Library::keyword (as is done with static things from the library) the keyword is highlighted but the function to find it in the reference does no longer work. Why is this and how do you fix this?

I can't change how IDE works


text:
Baudrate is set to 9600 automatically even if specifying a different value
You initialize the serial communication via USB with
Serial.begin(baudrate);

where baudrate is a long specifying the number of symbols you want to send over the connection per second. You can put pretty much any number in there, but not every number makes sense.
One thing that I found odd though is that I can't seem to actually use a different baudrate than 9600. The sketch compiles and uploads just fine, but if I check the actual speed of the serial port via
setserial -ag port

where port is the port of my Teensy 4.0 board (that command is something you can use in the terminal of Linux) or with
Serial.baud();

directly in the sketch it always says 9600. I suspect that this is caused by something inside the code behind Serial.begin() since I can manually set the baudrate via the terminal in Linux using
stty speed baudrate < port > port

where (again) baudrate is the speed I want to use and port is the port of my board (checking it with the first terminal command: it works). But when restarting the program on the board the baudrate reverts to 9600.
Does anyone know why this is and how to fix this?

The whole concept of Baud Rate with USB communication is completely meaningless.  There is no such thing as "baud rate" over USB.
What there is, and what you are confusing with "baud rate" is a configuration item which the host can send to the device which is a "I would like you to communicate with other devices at this speed" configuration item.
This is intended for use with USB to UART adaptors where it is used to configure the baud rate of a physical UART interface for downstream communication.
When you set the baud rate in your code it is ignored, since it has no meaning.
When you set the baud rate on your computer it sends it as this configuration value, which you can then retrieve, should you have an interest in that value, using the Serial.baud() function.

Of course there is a baudrate over USB. There is one for every communication. Do you mean to say that the Arduino IDE cannot change it?

@LukasFun No, there is no baud rate. There is a data rate, but that is largely unrelated to the actual rate of communication between the host and any one device, since it is a packet-based protocol.

So... how do you control the data rate of the USB connection then, I guess? And why would that rate not matter?

You don't control the data rate. The data rate is defined by the class of the interface and device. USB 1 ("Full Speed") is 12Mbps. USB 2 ("High Speed") is 480Mbps. USB 3 ("Super Speed") is 5Gbps. The chosen speed is the highest that both the device (Arduino) and host (computer) can work together at.

That data rate is divided amongst all devices on the bus.

Oh, and your device never sends data. It enqueues data, and it's the responsibility of the host to come and collect that data.

So, that means, that on USB native Arduino's the baudrate for communication over USB does not have any effect?

Correct. The parameter given to Serial.begin(...) is completely ignored.

Sorry for coming back at this again. While the communication rate of the USB port per se may be fixed, this does not mean that the serial port is actually doing what I want (communicate with maximum speed). That's because the serial port used for this communication is only emulated via the USB port. And the connection of that emulated port should be customizable. It is, in fact, as I specified in my question but is reset every time the controller runs a sketch. Is there any way to change the speed of the connection? I actually tested the speed and it was about 60000 Bits/s. Quite slow.

@LukasFun The port actually runs at the highest speed it can. It's not a fixed speed, but sends data at as fast a rate as the USB channel allows. The speed "resets" because every time the sketch runs the CDC/ACM port gets destroyed and recreated. It's effectively a completely new device, so it gets the system default settings. But since that "baud rate" has no meaning, changing it is irrelevant.

The "baud rate" is sometimes used to make the device do different things - for instance changing the baud rate to 1200 can cause the Arduino to reset into the bootloader for programming. I use 300 baud on a device I sell to enter a special lowlevel programming protocol mode.

The speed you obtain depends on many factors - what else is on the same USB bus, how powerful the target device is (how fast it can process the USB packets as they arrive), etc.

To put it another way: forget that it's an Arduino you're using and imagine it's an FT232 adaptor. When you set the baud rate you aren't setting the baud rate of the USB connection. You're informing the FT232 of the baud rate you would like it to communicate with whatever it is connected to at.

are you thinking of this purely in terms of USB? surely the serial (ie: RS232) communication itself that the USB generates must be at some particular baud rate to be able to communicate correctly with devices. the serial communication cannot be faster than the device expects or it will not be received properly.

The problem may be in flow control, as LukasFun suggested. Obviously, a low speed RS232 device will not be able to handle a continuous data stream at 1.5 Mbps
A quick look at this paper may help.
https://www.usconverters.com/index.php?main_page=page&id=49&chapter=0

source: Stack Exchange

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

sort: votes


text:
Atmega328p Uploads via ISP but not bootloader
I'm trying to upload a bootloader to my atmega328p on a custom pcb containing external oscillator at 16MHz. It is possible to upload program via ICSP pins using Arduino as ISP (Official Arduino Uno) but not possible to upload a bootloader. This pcb needs bootloader as it will be used via FT232RL interface.
I've tried to upload bootloader at 115200 baud rate but that did not read any device signature. Also exact definition of my IC is "ATMEGA328P-AU TQFP-32 8-bit 20MHz", if it helps.
P.S That exact definition says it is 20MHz but I suspect that's correct as I don't entirely trust that shop.
Thanks in advance
Upload log
Sketch uses 1626 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 192 bytes (9%) of dynamic memory, leaving 1856 bytes for local variables. Maximum is 2048 bytes.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.usbmodem14101 -b115200 -D -Uflash:w:/var/folders/9z/8cpdsm0518x0b85yx7n4y_0c0000gn/T/arduino_build_452635/sketch_dec06a.ino.hex:i

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/deniz/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem14101
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/var/folders/9z/8cpdsm0518x0b85yx7n4y_0c0000gn/T/arduino_build_452635/sketch_dec06a.ino.hex"
avrdude: writing flash (1626 bytes):

Writing | ################################################## | 100% 0.27s

avrdude: 1626 bytes of flash written
avrdude: verifying flash memory against /var/folders/9z/8cpdsm0518x0b85yx7n4y_0c0000gn/T/arduino_build_452635/sketch_dec06a.ino.hex:
avrdude: load data flash data from input file /var/folders/9z/8cpdsm0518x0b85yx7n4y_0c0000gn/T/arduino_build_452635/sketch_dec06a.ino.hex:
avrdude: input file /var/folders/9z/8cpdsm0518x0b85yx7n4y_0c0000gn/T/arduino_build_452635/sketch_dec06a.ino.hex contains 1626 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.21s

avrdude: verifying ...
avrdude: 1626 bytes of flash verified

avrdude done.  Thank you.

Bootloader log (P.S. all sync attempts happen at the same time)
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/cu.usbmodem14101 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/deniz/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem14101
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x60
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x66
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x78
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1e
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x06
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x7e
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe6
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x80
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x98
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x80

avrdude done.  Thank you.

Have you tried to "Burn Bootloader"? Because by default it uploads compiled sketch without bootloader (it can be changed in board settings to use hex file with bootloader too).

That output is from Burn Bootloader button specified in Arduino IDE. So is it possible to upload bootloader and sketch at the same time?

In the build direcotry there'll be another hex file like this: sketch_dec06a.ino.with_bootloader.hex (however can't remember where it should be set exactly)

Yep I found it. I'll be trying that one. Also will there be a problem with flashing sketch with bootloader without redefining fuse-bits?

Also if you can write your comment as an detailed answer I can approve if it works

And are you sure the first is really working? The programmer = arduino is usually bootloader. You should see that stk500v1 too if you are using "Upload Using Programmer" (programmer must be set to Arduino as ISP). Maybe you've just uploaded it directly into the arduino that should be an programmer instead (and removed that ArduinoISP sketch from it)

I've uploaded ArduinoISP sketch again and tried to upload only the sketch, with_bootloader and only bootloader but no luck. I've updated the upload log in the question. Seems like programmer can't read target's device signature. I've successfully uploaded the bootloader to two of the same PCBs but no luck on this one.

If you have time to look into this more deeply I can move this comment section to a chat. I would be very happy if it's possible.

Let us continue this discussion in chat.

The first issue might be in Upload log. There is mentioned programmer = arduino (in version before edit). That means you might be uploading code into the wrong Arduino. So there is no ArduinoISP sketch and it won't work (getsync() errors)
Check if the upload is working between two arduinos, that should opted out wrong wiring on the programmer side and so on.
And as it's self made board, there might be some issues with wiring, omitting bypass capacitors (as it turned out in chat discussion - it was the main issue)

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


text:
post data from node mcu to my sql database
#include <ESP8266WiFi.h>

const char* ssid = "xxxx";
const char* password = "xxxxxxxxxx";

const char* host = "192.168.43.18";
const int ldr = A0;
int val = 0;

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

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");
}

void loop()
{
  val = analogRead(ldr);
  WiFiClient client;

  Serial.printf("\n[Connecting to %s ... ", host);
  if (client.connect(host, 80))
  {
    Serial.println("connected]");
    client.println("POST /past.php HTTP/1.1");
    client.println("Host: 192.168.43.10");
    client.print(val);
    Serial.println(val);
    Serial.println("\n[Disconnected]");
  }
  else
  {
    Serial.println("connection failed!]");
    client.stop();
  }
  delay(5000);
}

I have uploaded this code to node mcu but it get's working but the uploaded data in my database is not shown please any one help me out

I'd expect one empty line after the headers, and also Content-Length header with actual length of val (its string representation, not sizeof int!).

and stop the client after the request

@Juraj In this case I'd expect the destructor takes care about it. If not, it's definitely a bug in the library.

yes the destructor closes the connection. and why do you close it in else? :-)

the ip addresses are not same

My corrected code working code:
#include <ESP8266WiFi.h>

const char* ssid = "vathsal";
const char* password = "1234567890";

const char* host = "wwwkprstaffcom.000webhostapp.com";
const int ldr = A0;
int val = 0;
String data;
void setup()
{
  Serial.begin(9600);
  Serial.println();

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");
}

void loop()
{
  val = analogRead(ldr);
  data = "ldr=";

  data.concat(val);
  WiFiClient client;

  Serial.printf("\n[Connecting to %s ... ", host);
  if (client.connect(host, 80))
  {
    Serial.println("connected]");
    client.println("POST /add.php HTTP/1.1");
    client.println("Host: wwwkprstaffcom.000webhostapp.com");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.println(data.length());
    client.println();
    client.print(data);
    Serial.println(val);
    Serial.println("\n[Disconnected]");
  }
  else
  {
    Serial.println("connection failed!]");
    client.stop();
  }
  delay(5000);
}

Generally speaking, just dropping code does not make an answer.  To constitute an answer, you really should start with an explanation of what you changed and why.

You are using the WIFIClient to send data to a HTTP server.  I don't think the WiFiClient knows how to format HTTP requests properly so you need to do that.  I think there is a HTTPClient which may do more for you.
There is a blank line between the header and body of the message and a blank line at the end of the body. you need to have a line that say `client.println();
Does the "SQL server" accept a message that just contains a number?  How does it know what the number relates to?  If you have some PHP site on the front if the DBS that handles all that then please ignore that question.
You might want to see if you can run Wireshark (or similar) on your PC and see what the MCU is sending, you might also want to look at the Chrome add ins, I believe there are some where you can create raw packets and send those to you server to ensure it responds as expected.
As a final resort you could probably knock up a very quick and dirty C# program using Visual Studio Community Edition (Free) and get that to send a packet to the server.  Using this in combination with wireshark might be easier than using the MCU until you know what you should be doing.

println writes /r/n

Good, because it looks ugly with all those \r\ns in :)  Still need  blank lines though, which can just be two println("");

yes there is HTTP client but it doesn't work so tat i am using wifi client.the wifi client can be used  to send data from from node mcu to http server because we are making the node mcu to act as client at this place  we are naming the website as host because as we know the host can act as both server r as client based on service so in my corrected code u could see that i am naming as host

please refer my corrected code for reference since it is working

You are not actually posting any data.
After client.println("POST /past.php HTTP/1.1");
Add another line(s) like ...
client.println("?myvar=65dcsagh&anothervar=ghsadjkj78");
Also the page on the server (past.php) needs to be able to get and process the sent data.
If using PHP will be soemthing like..
$data = $_GET[myvar];
And then the PHP code need to connect to your SQL database and insert it using mySQL

there is client.print(val);

opps sorry didn't see that then does the second part of my answer help?

he doesn't ask about the php part

No but he does say the data is not entered into the database so without knowing what is in past.php that could be the problem part

guys actually i didn't concatenate the data so tat's wat the problem without concatenate we cannot send the data else if we do the php code which is written on other side will not recognise it

This actually does look to be making an important point.


text:
what command should i use to read and write through spi.tranfer command
#include<spi.h>
byte val;     // variabe for storing temp data
#define PIN_SPI_SS    (9)
#define PIN_SPI_MOSI  (10)
#define PIN_SPI_MISO  (11)
#define PIN_SPI_SCK   (12)

void setup();
pinMode(SS,output);
pinMode(SCLK,output);
pinMode(MOSI,output);
spi.setBitorder(MSBFIRST);
SPI.setDataMode(SPI_MODE3);
serial.begin(9600);
spi.begin();

void loop();
  digitalWrite(SS,LOW);
  uint8_t b1 = SPI.transfer(0x00);
  uint8_t b2 = SPI.transfer(0x00);
  uint8_t b3 = SPI.transfer(0xFF);
  digitalWrite(SS,HIGH);
  int16_t val = b1 | b2 ;
  serial.print("val=");
  serial.println(val,DEC);

refer for DATA SHEET//https://www.ti.com/lit/ds/symlink/lm74.pdf?ts=1591436049550&ref_url=https://www.ti.com/product/LM74
my problem is i am not able to know what command should i use in SPI.transfer function for writing & reading  temperature data here i use 0x00 for reading 16 bit data of temperture register,but what about writing in configuration register  ,LM74 use 0xFF command for shutdown mode,but  how we came to know that 0xFF refer only to configuration register.

In the LM74 the third byte you send (or more specifically the last 8 bits of up to 32 bits past the 16th bit that you send) is read and used as the configuration register setting.
Since the configuration register only has two states 0xFF is go to sleep sleep and 0x00 is do conversions (as shown in table 1 of the datasheet).
So:
0x00 0x00 0xFF

means get one result then go to sleep.
0x00 0x00 0x00

means get one result and stay awake.
If the LM74 is currently asleep from an 0x00 0x00 0xFF sequence the result you get returned is not a temperature but the chip's manufacturer ID.
It's not an obvious method of controlling a chip, and it's actually pretty poorly written in that datasheet, so don't feel bad about not understanding it, it took me a few moments to understand it.


text:
Trying to read the current position of a flex sensor and store it as a variable? NANO ATmega328p
I am trying to write a code to read the current position of a flex sensor when a button is pushed and use that data to pulse a piezo. I set it up to read the flex sensor and to alarm when it gets 100 or below, that works! So what I want to do is integrate a button where you push it to set the current state of the flex sensor and then when its moved and is less than the number logged when the button was pressed then it alarms. I used to write in Basic and quick basic and am now (many years later in life) trying to learn C and am struggling. I'm using a NANO ATmega328p - here is my code so far:
int flexSensorPin = A0;//analog pin 7= tiny2=A1
const int Piezo = 3; //digital pin 3 = tiny0
const int inPin = 2; // Push Button to set current Bend Status
void setup() {
  pinMode (Piezo, OUTPUT);
  pinMode(inPin, INPUT);    // declare pushbutton as input
  Serial.begin(9600);
}
void loop() {
  int val = 0;
  val = digitalRead(inPin);
  int flexSensorReading = analogRead(flexSensorPin);
  Serial.println(flexSensorReading);
  if (flexSensorReading < 100) {
    Serial.println("Alarm! Set Angle Exceeded");
    digitalWrite(Piezo, HIGH);
    delay(100);
    digitalWrite(Piezo, LOW);

  }
  delay(250);
}

And what is your specific problem in writing the code? You already read the state of the button pin and the analog voltage of the flex sensor. Use an if statement, where you set a variable to the analog value, if the button was pressed. Then replace the 100 in your first if statement with this variable.

And two other things for when you have done this: For the button to be responsive you should ditch those delay() calls and use non-blocking code (refer to the BlinkWithoutDelay example of the Arduino IDE). And then it might be necessary to debounce your button. For this you can find plenty tutorials on the web.

Also depending on your wireup you might want to use INPUT_PULLUP instead of INPUT if you don't have an external pull-up resistor attached to your button input. (https://www.arduino.cc/en/Tutorial/InputPullupSerial)

Also the TimedAction library (https://playground.arduino.cc/Code/TimedAction) will help you to periodically flip the piezo output (if an alarm needs to be triggered) every 100ms. You thus get rid of the delay() calls and your button will become more responsive. For button debouncing, you can also use the Button library (https://playground.arduino.cc/Code/Button).

You will need to add this at the start of your code.
int LoggedPosition=100;

Change this line
if (flexSensorReading < 100) {

To this
if (flexSensorReading < LoggedPosition) {

and add this at just before the delay, at the end of the loop() function
if(digitalRead(inPin)){
    LoggedPosition=flexSensorReading;
}

I entered that code but it appears to reset the value to a new value every time its flexed so you keep flexiing until the value exceeds the flex sensor. it's like what I want sort of. but not.. I want it to set the value of the current position when the button is pressed or when powered up then use that value as the "boundary" point where if that's met or exceeded then the alarm sounds and continues to sound until the button is pressed to reset the value or the flex sensor is moved to the "safe" position.

I think your button gives a low voltage to the pin, when pressed. It's a bit counter-intuitive, but that is the only thing that could cause this behaviour.You will need to change if(digitalRead(inPin)) to if(digitalRead(inPin)==0).  Check if this works.


text:
I2C libraries for ATTiny85?
I want to transmit I2C data, using a Digispark ATTiny85 board:

http://digistump.com/products/1
http://digistump.com/wiki/digispark/tutorials/connecting

I've found the following I2C libraries. Which one is more lightweight, stable, bug-free, efficient, powerful, and easy to use?

Adafruit's TinyWireM has not been updated in 2 years.
felias-fogg's SoftI2CMaster has been updated within days of this post.
lucullusTheOnly's TinyWire represents some years of improvements, "based on the TinyWireM and TinyWireS libraries". This version is recommended by BroHogan, co-creator of TinyWireM:
https://playground.arduino.cc/Code/USIi2c

Wire seems under-featured:

"the default Arduino Wire() library does not support changes in bus
  speed or feature proper clock stretching support. This makes the
  default library only marginally functional"
  https://www.maxbotix.com/articles/095.htm

What other I2C libs are available for ATTiny? In the IDE i see Digispark SoftSerial, OneWire, and VirtualWire.
How do they all compare?

Note, these other answers do not seem relevant to my question:

What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible?
Alternatives to Wire library for I2C

try them both  ... the one with the most example code first

I want to transmit I2C data...

A little vague.
Transmit to what device? How fast is your data rate (100kHz, 400kHz)? Your only transmitting and not reading anything back? What is the idling voltage of your I2C bus (to then ask if you have chosen correct pull-up resistor values for your intended bus speed)?
You mention that the Wire library doesn't support core clock speed changes without some hacking, but don't talk about the speed you intend to run the microcontroller or how fast you intend to use the I2C. I can guess 400kHz, since you brought up speed, but that's not a great way to answer a question.
I have using the Wire library on an Arduino UNO at I2C bus rate of 100kHz and it's worked fine for my needs. I got bytes in and out.
At this point, the best suggestion I'd have is that if one of the above libraries you listed does not support a feature you'd like, fork it, and add support for your feature yourself. If you're only transmitting to one slave device, then you shouldn't need to worry about bus arbitration, like the TinyWire does. Adafruit is okay for the most part, but they seem (to me) slow to fix bugs and maintain code. But don't let the code's age get to you. I2C was created back in 1982, and you're still using it... :-P
Here's how I would approach choosing a library:

Define features you need
Look for a library which has most of those features
Add any new features you need
Possibly share your added features with the community with a Pull Request

bHogan seems to be the original developer of TinyWireM and TinyWireS.
Andreas Spiess ("The guy with the Swiss accent") used rambo's implementation of the TinyWire library for his I2C sensor, and rambo on GitHub and bHogan on arduino.cc seem to be the same person...
I've also used rambo's TinyWire library, and managed to make it work. Adafruits version of TinyWire seems to be a fork of rambo's code.

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


text:
Fonts/Org_01.h: No such file or directory
I have written one Arduino code for working with tft lcd 2.4 and  in it i used <Fonts/Org_01.h> new font ,It was working in my Win8 OS but now in Linux OS i have installed new Arduino in my Linux OS and in this Arduino i have get this error:

exit status 1 Fonts/Org_01.h: No such file or directory

the entire codes are shown blown:

#include <Adafruit_GFX.h>    // Adafruit's core graphics library
#include <Adafruit_TFTLCD.h> // Adafruit's hardware-specific library
#include <TouchScreen.h>     //Touchscreen library
#include <Fonts/Org_01.h>    //Include a different font
#include <EEPROM.h>         //Include the EEPROM library to score the highscore
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

#include <TimeLib.h>

bool backsensed = false;
bool resetsensed = false;

// most mcufriend shields use these pins and Portrait mode:
uint8_t YP = A1;  // must be an analog pin, use "An" notation!
uint8_t XM = A2;  // must be an analog pin, use "An" notation!
uint8_t YM = 7;   // can be a digital pin
uint8_t XP = 6;   // can be a digital pin

#define TS_MINX 100
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940
//Create the touchscreen object
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);  //(data,data,data,data,sensitivity);

//Some of the tft pins
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// Optional, used to reset the display
#define LCD_RESET A4

#define REDBAR_MINX 80
#define GREENBAR_MINX 130
#define BLUEBAR_MINX 180
#define BAR_MINY 30
#define BAR_HEIGHT 250
#define BAR_WIDTH 30

//Create the tft object
//Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

// Define some TFT readable colour codes to human readable names
#define BLACK   0x0000
int BLUE = tft.color565(50, 50, 255);
#define DARKBLUE 0x0010
#define VIOLET 0x8888
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
int GREY =  tft.color565(64, 64, 64);
#define GOLD 0xFEA0
#define BROWN 0xA145
#define SILVER 0xC618
#define LIME 0x07E0

int currentpcolour;

//Minimum and maximum pressure to sense the touch
#define MINPRESSURE 10
#define MAXPRESSURE 1000

#define DRAW_LOOP_INTERVAL 50  //The interval used instead of delay();

//Define the address used in the eeprom memory to store highscores
#define addr 0
int currentpage;

int currentWing;        //Used to flap the wings
int flX, flY, fallRate; //Used to calculete and store the bird's position
int pillarPos, gapPosition;  //Used tho draw the pillars
int score;              //Store the score
int highScore = 0;      //Store the highscore
bool running = false;   //Store weather flying or not
bool crashed = false;   //Store weather crashed or not
bool scrPress = false;  //Store weather sensed some touch and store
long nextDrawLoopRunTime;
int redval;
int greenval;
int blueval;

int redpos = BAR_MINY + 12;
int greenpos = BAR_MINY + 12;
int bluepos = BAR_MINY + 12;

int oldrpos = redpos;
int oldgpos = greenpos;
int oldbpos = bluepos;
int x, y;

int lastDay = 0;
int lastMonth = 0;
int lastYear = 0;
int lastHour = 0;
int lastMinute = 0;
int lastSecond=0;
int movementTimer = 0;
int menuOptions = 4;
int menuOption = 0;
int alarmHours = 0;
//int Heater_alarmMinutes = 0;
//int Heater_alarmSecond=10;
//int Motor_alarmSecond=10;
//int Motor_alarmMinutes=0;

byte Heater_alarmMinutes_end ;
byte Heater_alarmSecond_end;
byte Motor_alarmSecond_end;
byte Motor_alarmMinutes_end;

bool heater_key = 0;
bool backLightOn = 1;
int fadeValue = 255;

byte address=0;
byte value;

bool state=1;

//#$############# MLX9615 ##################

 unsigned char Re_buf[11],counter=0;
 char sign=0;
float TO=0,TA=0;
void serialEvent();

//########################################
void DrawTriangle() {
 int n, i, cx = tft.width() / 2 - 1, cy = tft.height() / 2 - 1;

 tft.fillScreen(BLACK);
 n = min(cx, cy);

 for (i = 0; i < n; i += 15) {
 tft.drawTriangle(
 cx , cy - i, // peak
 cx - i, cy + i, // bottom left
 cx + i, cy + i, // bottom right
 tft.color565(0, 0, i));
 }
}
void drawHome()
{

  tft.fillScreen(BLACK);
  tft.drawRoundRect(0, 0, 319, 240, 8, WHITE);     //Page border

  tft.fillRoundRect(60, 180, 200, 40, 8, RED);
  tft.drawRoundRect(60, 180, 200, 40, 8, WHITE);  //Game

  tft.fillRoundRect(60, 130, 200, 40, 8, RED);   //RGB led
  tft.drawRoundRect(60, 130, 200, 40, 8, WHITE);

  tft.fillRoundRect(60, 80, 200, 40, 8, RED);
  tft.drawRoundRect(60, 80, 200, 40, 8, WHITE); //Oscilloscope

  tft.setCursor(60, 20);
  tft.setTextSize(2);
  tft.setFont();
  tft.setTextColor(WHITE);
  tft.print("Select on Option");
  tft.setCursor(70, 50);
  tft.setTextSize(2);
  tft.setTextColor(LIME);
  tft.print("GSH.ir");
  tft.setTextColor(BLACK);

  tft.setCursor(80, 95);
  tft.print("Heater Setting");

  tft.setCursor(80, 145);
  tft.print("Motor  Setting");

  tft.setCursor(70, 195);
  tft.print("     Start");

  //tft.drawCircle(30, 30, 20, RED);
  //tft.fillCircle(111, 111, 30, WHITE);
  //  delay(500);
  //tft.drawRoundRect(120, 192, 60, 64, 15, YELLOW);
  // tft.fillRoundRect(0, 192, 60, 64, 15, CYAN);

   // tft.drawRect(0, 0, 60, 64, CYAN);

   //  tft.fillRect(180, 192, 60, 64, GREY);
     //DrawTriangle();

}

void drawstart(bool k)
{

  tft.fillScreen(BLACK);
  tft.drawRoundRect(0, 0, 319, 240, 8, WHITE);     //Page border

//  tft.fillRoundRect(60, 180, 200, 40, 8, RED);
//  tft.drawRoundRect(60, 180, 200, 40, 8, WHITE);  //Game
//
//  tft.fillRoundRect(60, 130, 200, 40, 8, RED);   //RGB led
//  tft.drawRoundRect(60, 130, 200, 40, 8, WHITE);
//
  tft.fillRoundRect(90, 60, 160, 60, 18, RED);
  tft.drawRoundRect(90, 60, 160, 60, 18, WHITE); //Oscilloscope

  tft.setCursor(40, 180);
  tft.setTextSize(3);
  tft.setFont();
  tft.setTextColor(WHITE);

  if (k) {
    tft.print("Motor on time");
  }else{
    tft.print("Heater on time");
  }

}
void drawMenu(bool k)
{
   tft.fillScreen(BLACK);

  tft.drawRoundRect(0, 0, 319, 240, 8, WHITE);     //Page border

//  tft.fillRoundRect(60, 180, 200, 40, 8, RED);
//  tft.drawRoundRect(60, 180, 200, 40, 8, WHITE);  //Game
//
//  tft.fillRoundRect(60, 130, 200, 40, 8, RED);   //RGB led
//  tft.drawRoundRect(60, 130, 200, 40, 8, WHITE);
//
//  tft.fillRoundRect(75, 80, 160, 60, 18, BLUE);
 // tft.drawRoundRect(700, 60, 160, 80, 18, WHITE); //Oscilloscope

  //tft.fillTriangle(60,60,20,120,180,180,RED);
  tft.fillRoundRect(70, 75, 180, 70, 18, GREEN);
   //tft.fillTriangle(42, 20, 42, 60, 90, 40, RED);
   tft.fillTriangle(260,90, 260, 130, 300, 110, RED);
   tft.fillTriangle(60,90, 60, 130, 20, 110, RED);

  tft.setCursor(45, 180);
  tft.setTextSize(2.95);
  tft.setFont();
  tft.setTextColor(WHITE);
  if (k) {
    tft.print("Motor Timer Setting");
  }else{
    tft.print("Heater Timer Setting");
  }
//  tft.fillRoundRect(5, 5, 80, 60, 8, WHITE);
//  delay(70);

  tft.setTextSize(4);
  tft.fillRoundRect(5, 5, 80, 60, 8, RED);
  tft.drawRoundRect(5, 5, 80, 60, 8, WHITE);
  tft.setCursor(20,20);
  tft.print("<-");

   tft.fillRoundRect(230, 5, 85, 60, 8, BLUE);
  tft.drawRoundRect(230, 5, 85, 60, 8, WHITE);
  tft.setCursor(250, 20);
  tft.print("OK");

}

void start(){
  tft.fillScreen(BLACK);
   drawstart(0);
   setTime(0, 0, 1, 20, 1, 2013); // hour, min, sec, day, month, year
  lastHour = hour();

          //check for heater key pressed

   heater_key=1;state =1;
 while (state ){

   if ( lastSecond!=second())
   {
       lastMinute = minute();
       lastSecond=second();
       tft.setTextSize(6);
       tft.fillRoundRect(60, 60, 200, 100, 18, RED);
       //tft.fillScreen(BLACK);
       tft.setTextColor(WHITE);
       tft.setCursor(110, 85);
       tft.print(lastMinute);
       tft.setCursor(140,85);
       tft.print(":");
       tft.setCursor(170, 85);
       tft.print(lastSecond);
       //delay(1000);
   }
   if (heater_key)
    {
      // alarm set
      if ((Heater_alarmSecond_end <= lastSecond) && (Heater_alarmMinutes_end == lastMinute))
      {
         state=0;
         digitalWrite(A5, LOW);

      }
       if ((Heater_alarmSecond_end >= lastSecond) || (Heater_alarmMinutes_end >= lastMinute))
         {
          //sound alarm
          digitalWrite(A5, HIGH);
          //setOffAlarm();
         }
     }
   }

    drawstart(1);
    state =1;
   setTime(0, 0, 0, 20, 1, 2013); // hour, min, sec, day, month, year
   while (state){
   if ( lastSecond!=second())
   {
       lastMinute = minute();
       lastSecond=second();
       tft.setTextSize(6);
       tft.fillRoundRect(60, 60, 200, 100, 18, RED);
       //tft.fillScreen(BLACK);
       tft.setTextColor(WHITE);
       tft.setCursor(110, 85);
       tft.print(lastMinute);
       tft.setCursor(140,85);
       tft.print(":");
       tft.setCursor(170, 85);
       tft.print(lastSecond);
       //delay(1000);
   }
   if (1)
    {
      // alarm set
      if ((Motor_alarmSecond_end <= lastSecond) && (Motor_alarmMinutes_end == lastMinute))
      {
         state=0;
         digitalWrite(A6, LOW);

      }
       if ((Motor_alarmSecond_end >= lastSecond) || (Motor_alarmMinutes_end >= lastMinute))
         {
          //sound alarm
          digitalWrite(A6, HIGH);
          //setOffAlarm();
         }
     }
   }

//########### MLX90615 @#############
   char i=0,sum=0;

//  for (i=0;i<100;i++){
   score=1;
    while(score==1){
    serialEvent();
    if(sign)
    {
       sign=0;
       for(i=0;i<8;i++)
        sum+=Re_buf[i];
       if(sum==Re_buf[i] )
       {
             TO=(float)(Re_buf[4]<<8|Re_buf[5])/100;
             if ((int)TO>=30){
              score=0;
             }
             tft.setTextSize(3);
             Serial.print("TO:");
             Serial.println(TO);
            tft.fillScreen(BLACK);
            tft.setCursor(10, 15);
            tft.print("Temprature :");
            tft.setCursor(10, 50);
            tft.print(TO);tft.setCursor(100, 30);tft.print("C");
             TA=(float)(Re_buf[6]<<8|Re_buf[7])/100;
             Serial.print("TA:");
             Serial.println(TA);
             delay(100);
     }
    }
  }
//####################
   delay(1000);
   drawHome();
   return;

}

void menu(){

// drawMenu();

 TSPoint p = ts.getPoint();     // Read touchscreen
 state =1;
// while(state){
// if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
if (p.z > 10 && p.z < 1000)
    {
     tft.setTextSize(3);
            tft.setTextColor(RED);
            tft.setCursor(10, 10);
            tft.print(p.x);
            delay(500);

  }
// }
}
//########## MLX90615    #############
void serialEvent(){
  while (Serial1.available()) {
    Re_buf[counter]=(unsigned char)Serial1.read();
    if(counter==0&&Re_buf[0]!=0x5A) return;
    counter++;
    if(counter==9)
    {
       counter=0;
       sign=1;
    }
  }
}
//########################

void setup()
{

  time_t t = now(); // store the current time in time variable t
  pinMode(A5, OUTPUT);pinMode(A6, OUTPUT);

  tft.reset();
  tft.begin(tft.readID());
//  Serial.begin(9600);
//  Serial.println();
//  Serial.print("reading id...");
//  delay(500);
//  Serial.println(tft.readID(), HEX);

  tft.fillScreen(BLACK);
  tft.setRotation(1);

  currentpage = 0;

  tft.setTextSize(3);
  tft.setTextColor(WHITE);
  tft.setCursor(50, 140);
  tft.print("Loading...");

  tft.setTextColor(tft.color565(255, 255, 0));
  tft.setCursor(30, 70);
  tft.print("By:");

  tft.setCursor(30, 100);
  tft.print("NotesPoint.com GSH.IR");

  for (int i; i < 250; i++)
  {
    tft.fillRect(BAR_MINY - 10, BLUEBAR_MINX, i, 10, RED);
    delay(0.000000000000000000000000000000000000000000000000001);
  }

  tft.fillScreen(BLACK);
  score=14;
  if (EEPROM.read(1)==score){
  address=2;
  tft.setCursor(300, 100);
  tft.print("eeprom writed beffor");
  Heater_alarmSecond_end = EEPROM.read(address);
  Heater_alarmMinutes_end= EEPROM.read(address+1);
  Motor_alarmSecond_end = EEPROM.read(address+2);
  Motor_alarmMinutes_end = EEPROM.read(address+3);
  }
  else{
    tft.setCursor(300, 100);
  tft.print("new eeprom");
    address=1;
  EEPROM.write(address,14);
  EEPROM.write(address+1,10);
  EEPROM.write(address+2,4);
  EEPROM.write(address+3,10);
  EEPROM.write(address+4,0);
  address=1;

  Heater_alarmSecond_end = EEPROM.read(address);
  Heater_alarmMinutes_end= EEPROM.read(address+1);
  Motor_alarmSecond_end = EEPROM.read(address+2);
  Motor_alarmMinutes_end = EEPROM.read(address+3);
  }
  delay(1000);
  drawHome();
  setTime(0, 0, 0, 20, 1, 2013); // hour, min, sec, day, month, year
  //########### MLX90615 ############

Serial1.begin(115200);Serial.begin(115200);
  delay(1);
  Serial1.write(0XA5);
  Serial1.write(0X45);
  Serial1.write(0XEA);
  Serial.write(0XA5);

//#############################

}
void loop()
{

//  digitalWrite(13, HIGH);
  TSPoint p = ts.getPoint();     // Read touchscreen
//  digitalWrite(13, LOW);

  pinMode(XM, OUTPUT);
  pinMode(YP, OUTPUT);
//########### MLX90615 @#############
   char i=0,sum=0;

//  for (i=0;i<100;i++){
   score=1;
    while(score==1){
    serialEvent();
    if(sign)
    {
       sign=0;
       for(i=0;i<8;i++)
        sum+=Re_buf[i];
       if(sum==Re_buf[i] )
       {
             TO=(float)(Re_buf[4]<<8|Re_buf[5])/100;
             if ((int)TO>=30){
              score=0;
             }
             tft.setTextSize(3);
             Serial.print("TO:");
             Serial.println(TO);
            tft.fillScreen(BLACK);
            tft.setCursor(10, 15);
            tft.print("Temprature :");
            tft.setCursor(10, 50);
            tft.print(TO);tft.setCursor(100, 30);tft.print("C");
             TA=(float)(Re_buf[6]<<8|Re_buf[7])/100;
             Serial.print("TA:");
             Serial.println(TA);
             delay(100);
     }
    }
  }
//####################
  if (currentpage == 0)
  {
    if (p.z > 10 && p.z < 1000)
    {

      if (p.x > 736 && p.x < 855 && p.y > 255 && p.y < 725  && p.z > MINPRESSURE && p.z < MAXPRESSURE)
      {

        start();

//        delay(1000);

      }

      else if (p.x > 563 && p.x < 683 && p.y > 275 && p.y < 750)
      {

        currentpage = 4;
        x = 0;
        y = 0;
        p.z = 0;
/
      drawMenu(1);
      tft.setTextSize(6);
       tft.fillRoundRect(70, 75, 180, 70, 18, GREEN);
            tft.setTextColor(WHITE);
       if (Motor_alarmMinutes_end==10){
       tft.setCursor(85, 90);
       tft.print(Motor_alarmMinutes_end);
       tft.setCursor(145,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Motor_alarmSecond_end);
       }else{
       tft.setTextColor(WHITE);
       tft.setCursor(110, 90);
       tft.print(Motor_alarmMinutes_end);
       tft.setCursor(140,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Motor_alarmSecond_end);

       }

      }

      if (p.x > 403 && p.x < 525 && p.y > 271 && p.y < 725)
      {
//        Serial.println("Oscilloscope");

        currentpage =5;

//        tft.fillRoundRect(60, 80, 200, 40, 8, WHITE);
//        delay(70);
//
//        tft.fillRoundRect(60, 80, 200, 40, 8, RED);
//        tft.drawRoundRect(60, 80, 200, 40, 8, WHITE);
//
//        tft.setCursor(80, 95);
//        tft.print("Oscilloscope");
//        delay(70);
        drawMenu(0);
        tft.setTextSize(6);
       tft.fillRoundRect(70, 75, 180, 70, 18, GREEN);
            tft.setTextColor(WHITE);
       if (Heater_alarmMinutes_end==10){
       tft.setCursor(85, 90);
       tft.print(Heater_alarmMinutes_end);
       tft.setCursor(145,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Heater_alarmSecond_end);
       }else{
       tft.setTextColor(WHITE);
       tft.setCursor(110, 90);
       tft.print(Heater_alarmMinutes_end);
       tft.setCursor(140,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Heater_alarmSecond_end);

       }
//        drawOSC();

      }
    }

  }

  if (currentpage == 4){
//   menu();

       //tft.fillScreen(BLACK);

if (p.z > 10 && p.z < 1000)
    {
//     tft.setTextSize(3);
//            tft.setTextColor(RED);
//            tft.setCursor(10, 10);
//            tft.print(p.x);
//            //delay(500);

       tft.setTextSize(6);
       tft.fillRoundRect(70, 75, 180, 70, 18, GREEN);
            tft.setTextColor(WHITE);
       if (Motor_alarmMinutes_end>=10){
       tft.setCursor(85, 90);
       tft.print(Motor_alarmMinutes_end);
       tft.setCursor(145,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Motor_alarmSecond_end);
       }else{
       tft.setTextColor(WHITE);
       tft.setCursor(110, 90);
       tft.print(Motor_alarmMinutes_end);
       tft.setCursor(140,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Motor_alarmSecond_end);

       }

      if (p.y > 600 && p.x < 650 && p.x > 400 && p.y < 885)
        {
         if (Motor_alarmSecond_end==0){
                Motor_alarmSecond_end=59;
                if (Motor_alarmMinutes_end==0){
                    Motor_alarmMinutes_end=10;}
                else {
                      Motor_alarmMinutes_end=Motor_alarmMinutes_end-1;
                }
                }
          else {
            Motor_alarmSecond_end=Motor_alarmSecond_end-1;
            }
           }

          if (p.y > 150 && p.x < 700 && p.x > 400 && p.y < 400)
        {
         if (Motor_alarmSecond_end==59){
                Motor_alarmSecond_end=0;
                if (Motor_alarmMinutes_end==10){
                    Motor_alarmMinutes_end=0;
                     }
                else {
                      Motor_alarmMinutes_end=Motor_alarmMinutes_end+1;
                     }
                }
          else {
            Motor_alarmSecond_end=Motor_alarmSecond_end+1;
            }
           }
       if (p.y > 200 && p.x < 375 && p.x > 200 && p.y < 350)
      {

          EEPROM.write(address+3,Motor_alarmSecond_end);
          EEPROM.write(address+4,Motor_alarmMinutes_end);

        currentpage = 0;
        drawHome();
//        p.x = 160;
//        p.y = 760;
        return;
      }
       if (p.y > 750 && p.x < 315 && p.x > 50 && p.y < 1000)
      {

        currentpage = 0;
        drawHome();

        return;
      }

  }
}

if (currentpage == 5){
//   menu();

       //tft.fillScreen(BLACK);

if (p.z > 10 && p.z < 1000)
    {
//     tft.setTextSize(3);
//            tft.setTextColor(RED);
//            tft.setCursor(10, 10);
//            tft.print(p.x);
//            //delay(500);

       tft.setTextSize(6);
       tft.fillRoundRect(70, 75, 180, 70, 18, GREEN);
            tft.setTextColor(WHITE);
       if (Heater_alarmMinutes_end>=10){
       tft.setCursor(85, 90);
       tft.print(Heater_alarmMinutes_end);
       tft.setCursor(145,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Heater_alarmSecond_end);
       }else{
       tft.setTextColor(WHITE);
       tft.setCursor(110, 90);
       tft.print(Heater_alarmMinutes_end);
       tft.setCursor(140,90);
       tft.print(":");
       tft.setCursor(170, 90);
       tft.print(Heater_alarmSecond_end);

       }

        if (p.y > 600 && p.x < 650 && p.x > 400 && p.y < 885)
        {
         if (Heater_alarmSecond_end==0){
                Heater_alarmSecond_end=59;
                if (Heater_alarmMinutes_end==0){
                    Heater_alarmMinutes_end=10;}
                else {
                      Heater_alarmMinutes_end=Heater_alarmMinutes_end-1;
                }
                }
          else {
            Heater_alarmSecond_end=Heater_alarmSecond_end-1;
            }
           }

          if (p.y > 150 && p.x < 700 && p.x > 400 && p.y < 400)
        {
         if (Heater_alarmSecond_end==59){
                Heater_alarmSecond_end=0;
                if (Heater_alarmMinutes_end==10){
                    Heater_alarmMinutes_end=0;
                }
                else {
                      Heater_alarmMinutes_end=Heater_alarmMinutes_end+1;
                }
                }
          else {
            Heater_alarmSecond_end=Heater_alarmSecond_end+1;
            }
           }
        if (p.y > 200 && p.x < 375 && p.x > 200 && p.y < 350)
      {

          address=1;
          EEPROM.write(address+1,Heater_alarmSecond_end);
          EEPROM.write(address+2,Heater_alarmMinutes_end);

        currentpage = 0;
        drawHome();
//        p.x = 160;
//        p.y = 760;
        return;
      }
      if (p.y > 750 && p.x < 315 && p.x > 50 && p.y < 1000)
      {

        currentpage = 0;
        drawHome();
//        p.x = 160;
//        p.y = 760;
        return;
      }

  }
}
  if (currentpage == 1) //Flappy bird
  {
    senseBack();
    if (millis() > nextDrawLoopRunTime && !crashed) {
      drawLoop();
      checkCollision();
      nextDrawLoopRunTime += DRAW_LOOP_INTERVAL;
    }
    if (backsensed)
    {
      currentpage = 0;
      drawHome();
    }

    sensereset();

    ResetScore();

    // Process user input   If sensed a touch anywere on the screen eccept the area of the reset button
    if (p.z > MINPRESSURE && p.z < MAXPRESSURE && !scrPress && !resetsensed && !backsensed) {     //p.x < 199 && p.y < 293
      if (crashed) {
        // restart game
        startGame();
      }
      else if (!running) {
        // clear and restart
        tft.fillRect(0, 0, 320, 80, BLUE);
        running = true;
      }
      else
      {
        // Go up
        fallRate = -8;
        scrPress = true;
      }
    }
    else if (p.z == 0 && scrPress) {
      scrPress = false;
    }
  }

  if (currentpage == 2) // RGB mixer
  {

    if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
    {
      x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
      y = map(p.y, TS_MINY, TS_MAXY,  tft.height(), 0) + 30;

      tft.fillRoundRect(200, 5, 70, 40, 8, tft.color565(redval, greenval, blueval));

      if (y > 42 && y < 250)
      {
        if (x > 180 && x < 220)
        {

          redval = map(y, 42, 250, 0, 255);
          oldrpos = redpos;
          tft.fillRect(oldrpos, REDBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, BLACK);
          redpos = y;
          tft.fillRect(redpos, REDBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, RED);      //tft.drawRect(BAR_MINY, REDBAR_MINX, BAR_HEIGHT, BAR_WIDTH, WHITE);
          tft.fillCircle(14, REDBAR_MINX + 15, 10, tft.color565(redval, 0, 0));

        }

        if (x > 115 && x < 150)
        {
          greenval = map(y, 42, 250, 0, 255);
          oldgpos = greenpos;
          tft.fillRect(oldgpos, GREENBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, BLACK);
          greenpos = y;
          tft.fillRect(greenpos, GREENBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, GREEN);      //tft.drawRect(BAR_MINY, REDBAR_MINX, BAR_HEIGHT, BAR_WIDTH, WHITE);
          tft.fillCircle(14, GREENBAR_MINX + 15, 10, tft.color565(0, greenval, 0));

        }
        if (x > 40 && x < 80)
        {
          blueval = map(y, 42, 250, 0, 255);
          oldbpos = bluepos;
          tft.fillRect(oldbpos, BLUEBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, BLACK);
          bluepos = y;
          tft.fillRect(bluepos, BLUEBAR_MINX + 3, BAR_WIDTH - 10, BAR_WIDTH - 5, BLUE);      //tft.drawRect(BAR_MINY, REDBAR_MINX, BAR_HEIGHT, BAR_WIDTH, WHITE);
          tft.fillCircle(14, BLUEBAR_MINX + 15, 10, tft.color565(0, 0, blueval));

        }
      }

      if (p.y > 743 && p.x < 247 && p.x > 150 && p.y < 875)
      {
        tft.fillRoundRect(5, 5, 50, 30, 8, WHITE);
        delay(70);
        tft.fillRoundRect(5, 5, 50, 30, 8, BLUE);
        tft.drawRoundRect(5, 5, 50, 30, 8, WHITE);
        tft.setCursor(15, 15);
        tft.print("<-");
        delay(70);
        tft.fillRoundRect(5, 5, 50, 30, 8, BLACK);
        currentpage = 0;
        drawHome();
        p.x = 160;
        p.y = 760;
        redval = 0;
        blueval = 0;
        greenval = 0;
        redpos = BAR_MINY + 12;
        greenpos = BAR_MINY + 12;
        bluepos = BAR_MINY + 12;
        oldrpos = redpos;
        oldgpos = greenpos;
        oldbpos = bluepos;

      }
    }

  }

  if (currentpage == 3)  //Oscilloscope
  {
    for (uint16_t j = 0; j <= tft.width() + 1; j++ )

    {
      float volt;
      float signalY = map(analogRead(A5),  0,  4095,  tft.height() - 1,  1   ) ;

      tft.drawFastVLine( j,  46, tft.height(), BLACK);
      tft.drawFastHLine(j, 180.00, 1, RED);
      tft.drawFastHLine(j, 195.00, 1, WHITE);

      tft.drawPixel(j, signalY, GOLD);

      if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
        if (p.y > 743 && p.x < 247 && p.x > 150 && p.y < 875)
        {
          tft.fillRoundRect(5, 5, 50, 30, 8, WHITE);
          delay(70);
          tft.fillRoundRect(5, 5, 50, 30, 8, BLUE);
          tft.drawRoundRect(5, 5, 50, 30, 8, WHITE);
          tft.setCursor(15, 15);
          tft.print("<-");
          delay(70);
          tft.fillRoundRect(5, 5, 50, 30, 8, BLACK);
          currentpage = 0;
          drawHome();
          p.x = 160;
          p.y = 760;
          return;
        }

    }
  }

}

void drawLoop() { //Flappy bird functions
  // clear moving items
  clearPillar(pillarPos, gapPosition);   //Clear pillar
  clearFlappy(flX, flY);            //Clear bird

  // Move items
  if (running) {
    flY += fallRate;
    fallRate++;

    pillarPos -= 5;
    if (pillarPos == 0) {
      score++;
    }
    else if (pillarPos < -50) {
      pillarPos = 320;
      gapPosition = random(20, 120);    //Random gap position
    }
  }

So now i removed this part from my program but how could I add this font to my library?
Update:
My arduino Version is 1.8.9 similar this:

Thanks

How did you install the Linux version of Arduino? Did you download from arduino.cc? If not you are probably using a very very very old version that does not include the library include mechanism.

really i don't remember how to installed it but  in arduino website the version 1.8.9 which is mine is the last version.


text:
USB and LM7805 both to power Arduino
I have high current usage For my circuit as you can see below (link):

I like to power Arduino when it is not connected to PC by USB Connection, So I want to add one external power supply and connect it's GND And 5V to Arduino GND And 5V pins.
So with this new circuit, I have two power supply for Arduino uno as you can see below: :
1-USB Connection to PC
2- Powering the Arduino by External Power Supply and LM7805

So I Asked here about connecting two power supply for Arduino (external power supply and PC USB Connection) and check this circuit Safeness for USB Port of PC or the Arduino.
Thanks.

I'm not exactly sure what you're asking.

I don't see a problem with that. Should work

All you have done there is replicate the voltage regulator that is already on the Arduino itself. Seems a bit pointless to me. If you want higher current 5V then you should consider either a 5V supply (USB charger) or a switching regulator instead of linear. Otherwise you're really not achieving anything useful.

@Dave_Newton, I have updated the Question and make it clearer. Also based of the comments, i guess the Circuit would working.

Thanks, @Majenko. the question is When i have USB connection and the second power supply, can I connect GND And 5V pins of the new power supply and the Arduino pins ( GND and 5V Pins) to each others?

Sure you can. Just like the internal regulator is.


text:
My Arduino don't show port but is working
I have some problem with Arduino uno and asked here, so I have tried to work by my STM32F103C8 as alternative board, and solved my problem by this question:
Arduino Port Not detected and can not run it as root
But now I as seeing that the Arduino port again is not acceptable but I can upload the codes into the STM32F103C8 board, so I asked why this happen ?

Note : I have seen this post which the STm32F103C8 board have some port on Arduino IDE (as you can see below ):

Update:
I have seen The below post about the same problem as you can see below:
Can't open serial monitor using ST Link and STM32F103C8
But, based of the last part of above post,which is shown below,
I don't get have could i have enable the serial port connection for the STM32f103C8 Board:

I did everything as it was described in tutorial, flashing bootloader
was succes, everything went ok, but windows still can't recognize it.
I am thinking that maybe it is problem with that resistor and maybe i
have to mod it... I think I will be sticking to ST-Link for uploading
codes and USB-UART for serial. But thanks for help
And one more question, can you tell me how to reset my Blue Pill to
factory bootloader (how to delete stm32 bootloader that I installed)

Thank.

it doesn't work. only the tool reports a wrong result

Is there a default that it tries to transmit the sketch to if no ports are selected?

The STM32F103C8 has a native USB interface. You will only ever see a CDC/ACM (USB UART emulation) interface if you actively run code that implements a CDC/ACM interface.
The bootloader is separate to your code. I don't know what protocol the bootloader for your board uses, but it may not even have a CDC/ACM interface to it.
In short: it doesn't have a port because you haven't programmed it to have a port, and the code uploading doesn't use a port, so doesn't care.

Thanks, but was is the means of /dev/2 on the Arduino IDE result which shown here?!

It'll be something specific to dfu-util. Btw, dfu is a custom protocol that has no serial or anything like it.

So You are saying, For enabling the port option in Arduino IDE, I must burn some boatloader to the STM32f103c8 board by Arduino IDE or other software?

No, you just write a sketch that uses the usb serial.


text:
OTA framework update by GitHub server Connection fail error
I have tried to use some OTA programming method by website servers like this method which was not successful and asked here. So I have tried the own Arduino library shown below:
and changed the ESP OTA GitHub Library example code :

to this kind :
/*
  GitHub_Upgrade.ino - Example for ESP library for auto updating code from GitHub releases.
  Created by Gavin Smalley, November 13th 2019.
  Released under the LGPL v2.1.
  It is the author's intention that this work may be used freely for private
  and commercial use so long as any changes/improvements are freely shared with
  the community under the same terms.
*/

#include <ESP8266WiFi.h>
#include <FS.h>

#ifndef STASSID
#define STASSID "Adsl momo"
#define STAPSK  "xxxxxx"
#endif

// A single, global CertStore which can be used by all
// connections.  Needs to stay live the entire time any of
// the WiFiClientBearSSLs are present.
#include <CertStoreBearSSL.h>
BearSSL::CertStore certStore;

/* Set up values for your repository and binary names */
#define GHOTA_USER "soheilpaper" //"username"
#define GHOTA_REPO "ota_github_blink" //"repository"
#define GHOTA_CURRENT_TAG "2.0"
#define GHOTA_BIN_FILE "BlinkWithoutDelay_ino_esp8285.bin"//"sketchname.ino.d1_mini.bin"
#define GHOTA_ACCEPT_PRERELEASE 2

#include <ESP_OTA_GitHub.h>

void handle_upgade() {
    // Initialise Update Code
    //We do this locally so that the memory used is freed when the function exists.
    ESPOTAGitHub ESPOTAGitHub(&certStore, GHOTA_USER, GHOTA_REPO, GHOTA_CURRENT_TAG, GHOTA_BIN_FILE, GHOTA_ACCEPT_PRERELEASE);

    Serial.println("Checking for update...");
    if (ESPOTAGitHub.checkUpgrade()) {
        Serial.print("Upgrade found at: ");
        Serial.println(ESPOTAGitHub.getUpgradeURL());
        if (ESPOTAGitHub.doUpgrade()) {
            Serial.println("Upgrade complete."); //This should never be seen as the device should restart on successful upgrade.
        } else {
            Serial.print("Unable to upgrade: ");
            Serial.println(ESPOTAGitHub.getLastError());
        }
    } else {
        Serial.print("Not proceeding to upgrade: ");
        Serial.println(ESPOTAGitHub.getLastError());
    }
}

void setup() {
    // Start serial for debugging (not used by library, just this sketch).
    Serial.begin(115200);

    // Start SPIFFS and retrieve certificates.
    SPIFFS.begin();
    int numCerts = certStore.initCertStore(SPIFFS, PSTR("/certs.idx"), PSTR("/certs.ar"));
    Serial.print(F("Number of CA certs read: "));
    Serial.println(numCerts);
    if (numCerts == 0) {
        Serial.println(F("No certs found. Did you run certs-from-mozill.py and upload the SPIFFS directory before running?"));
        return; // Can't connect to anything w/o certs!
    }

    // Connect to WiFi
    Serial.print("Connecting to WiFi... ");
    WiFi.mode(WIFI_STA);
    WiFi.begin(STASSID, STAPSK);
    if ((WiFi.status() != WL_CONNECTED)) {
        Serial.print("... ");
    }
    Serial.println();

    /* This is the actual code to check and upgrade */
    handle_upgade();
    /* End of check and upgrade code */

    // Your setup code goes here

}

void loop () {
    // Your loop code goes here
Serial.println("main loop");
delay (1000);
Serial.println("handle_upgade starting: ...");

 handle_upgade();

 Serial.println("handle_upgade ednded: ...");

 delay (1000);

}

but I get the connection error:
checking for update...
Not proceeding to upgrade: Connection failed
handle_upgade ednded: ...

Again, I get some connection similar error like my previous question.
So I asked it to find some instruction for fixing it, if possible.
Thanks.

I don't fully understand this, but I haven't read through it completely either.  Given your apparent success in your other question about "Error 101 Server Did Not Report Size" is it fair to say that you got past whatever problem you were having here and that this question can be closed?


text:
esp8266 Arduino error : esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)
i have simple circuit for controlling the dc motor by bjt BC869 like this:

and this code:
/*
  ESP8266 Blink by Simon Peter
  Blink the blue LED on the ESP-01 module
  This example code is in the public domain

  The blue LED on the ESP-01 module is connected to GPIO1
  (which is also the TXD pin; so we cannot use Serial.print() at the same time)

  Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
#define dd 1
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
   pinMode(dd, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);
//  loop1() ;// Wait for two seconds (to demonstrate the active low LED)
}
void loop1() {
  digitalWrite(dd, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(dd, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

it was working days before but it stopped from working by connecting to prototype circuit by breadboard, but after connecting to this circuit it programmed for two  or three times and after that it showing this error:

Executable segment sizes:
IROM   : 227612          - code in flash         (default or ICACHE_FLASH_ATTR)
IRAM   : 26768   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...)
DATA   : 1252  )         - initialized variables (global, static) in RAM/HEAP
RODATA : 672   ) / 81920 - constants             (global, static) in RAM/HEAP
BSS    : 24880 )         - zeroed variables      (global, static) in RAM/HEAP
Sketch uses 256304 bytes (26%) of program storage space. Maximum is 958448 bytes.
Global variables use 26804 bytes (32%) of dynamic memory, leaving 55116 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port /dev/ttyUSB1
Connecting........_____....._____.
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: d8:bf:c0:ff:6f:30
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 260464 bytes to 190649...
Writing at 0x00004000... (16 %)Traceback (most recent call last):
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 2938, in main
    operation_func(esp, args)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 2374, in write_flash
    esp.flash_defl_block(block, seq, timeout=DEFAULT_TIMEOUT * ratio * 2)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 104, in inner
    return func(*args, **kwargs)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 672, in flash_defl_block
    self.ESP_FLASH_DEFL_DATA, struct.pack('<IIII', len(data), seq, 0, 0) + data, self.checksum(data), timeout=timeout)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 379, in check_command
    raise FatalError.WithResult('Failed to %s' % op_description, status_bytes)
esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)
esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)

So i have seen some suggestion like changing the USB port and dont worked for me, so i like to know why this happened and how could be solved ( by flashing the esp8266 or ...)
Update:
I have tried by the comment suggestion this code :
void setup() {}
void loop() {}
And get again that error:
Executable segment sizes:
IROM   : 227372          - code in flash         (default or ICACHE_FLASH_ATTR)
IRAM   : 26360   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...)
DATA   : 1252  )         - initialized variables (global, static) in RAM/HEAP
RODATA : 672   ) / 81920 - constants             (global, static) in RAM/HEAP
BSS    : 24848 )         - zeroed variables      (global, static) in RAM/HEAP
Sketch uses 255656 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 26772 bytes (32%) of dynamic memory, leaving 55148 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port /dev/ttyUSB1
Connecting........_____.
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: d8:bf:c0:ff:6f:30
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 259808 bytes to 190257...
Writing at 0x00004000... (16 %)Traceback (most recent call last):
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 2938, in main
    operation_func(esp, args)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 2374, in write_flash
    esp.flash_defl_block(block, seq, timeout=DEFAULT_TIMEOUT * ratio * 2)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 104, in inner
    return func(*args, **kwargs)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 672, in flash_defl_block
    self.ESP_FLASH_DEFL_DATA, struct.pack('<IIII', len(data), seq, 0, 0) + data, self.checksum(data), timeout=timeout)
  File "/home/so/snap/arduino/41/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool/esptool.py", line 379, in check_command
    raise FatalError.WithResult('Failed to %s' % op_description, status_bytes)
esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)
esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)

Thanks.

with problems like this, you should always start with minimal sketch void setup() {} void loop() {}  .... the sketch is probably irrelevant and only clutters up the post .... also remove all of the external hardware

i have done that but not solved!

Does it work when disconnecting the NodeMCU from the breadboard so that there are no externally connected components anymore?

I have had that error when the internal capacitance of the ESP32 module isn't enough by itself to run the module properly. You should add a 10uF capacitor across the 3.3V and GND pins on the module (direct on the module, not the PCB pins).

it was working days before but it stopped from working by connecting to prototype circuit by breadboard, so ...


text:
stm8tool is not available for you operating system (ubuntu OS)
I have tried to  add STM8 to arduino by this instruction :
but i have this error:

also my system is :
so@so-notebook:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

Also googled the :
stm8tool is not available for you operating system
but don't find any result to solve ...
Update:
based of comments :
so@so-notebook:~$ uname -a
Linux so-notebook 5.6.9-050609-generic #202005051753 SMP Tue May 5 22:00:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Thanks.

Please also post the output of uname -a

All seems fine on 20.04 to me... The content of the json file looks fine too.


text:
Searching for free OTA Server Host list name
I have seen this video:
Over The Air programming Tutorial
For programming the Arduino modules via internet  OTA system, so I have tried the adafruit account and don't find the AIO_KEY part on it, ( as you can see below):

So I like to know about other web server systems for testing this option on the Arduino module (for me is ESP8266 01!).
So please suggest some free internet website as alternative options  like suggested site via above video ( adafruit).
The codes for making the esp8266 ready to accept the OTA process is accessible here.
Note: Also the https://io.adafruit.com/ server have some Problem right now:
So if possible I like to know is any safe methods exist for the interrupt and server problem
situation like this (adafruit 503 error, seen below) during the Arduino  OTA programming?

Update:
I have found the link of adafruit OTA_Key :
https://io.adafruit.com/ss1/dashboards/<Your_acount_Name>

Thanks.


text:
Arduino shield stacking issue
I'm having issues stacking shields on my Arduino Mega 2560. I would like to add to the mega a ethernet shield (https://store.arduino.cc/products/arduino-ethernet-shield-2) and on top of that the dragino lora shield v1.4 (https://wiki.dragino.com/index.php?title=Lora_Shield). When I connect only the dragino lora shield to the mega I do get the lora to initialize but the moment I add the ethernet shield to the mega and the dragino lora shield to the ethernet shield the lora initialization fails. Is this stacking possible and if so any advice on how to get all to work together?
Thanks in advance.

idk about those 2 particularly, but in general, lots of shields are incompatible with other shields because they want to use up the same pins (gpios). Look that up in datasheet or sketch/libs.

Both those boards use pin 10 for chip select by default. You will need to change that.
Probably the simplest one to change is the LoRa board. If you look at the WiKi page you link to it lists a set of resistors and jumpers which can be altered to modify the connectivity of the board.  By default R9 is populated which connects to pin 10. If you move that to the R10 position next to it you will instead be connecting to D5 for the chip select pin. Moving surface mount resistors can be tricky though so you may want to practice working on a scrap board first.
And of course when you have changed the chip select pin you will also have to change your code to use that new chip select pin instead.

Thank you for your answer. I wanted to give it a try but found that my LoRa board is more like the v1.2 instead of the v1.4. It's hard to see since it's not written anywhere on the board. Can you maybe see a way around this problem on the v1.2 LoRa board?

@Ayayron They have obviously identified that this is a commonish problem and fixed it in the later version. You can remove R1 which will isolate pin 10, but they have no easy facility for connecting chip-select to somewhere else. You will have to solder a fine wire on the board between the pad of R1 furthest from the header to where you want it. Or (as long as this shield is the top of the stack) cut pin 10 off from the header and jumper between that pin's socket and the pin you want to use. Or if the pins are flexible enough bend it out of the way so it doesn't insert into the ethernet shield


text:
Apparently the photoresistors don't pass the input at the leds
I am making a school project where i need to create a parking loot in tinkercad. Me and my mate tried to use a bunch of photoresistor that worked as a sensor. No light = car = red led; light = no car = green led. We can't figure out why the leds dont turn on. We are still on a low level of abilities on this type of work and in class we didn't see a lot of components, so the photoresistor were one of the best choice.
Here is the screenshot of the whole project, it's in italian so if you guys needs a transduction of the variable just tell me. Don't mind the button, we were trying something.

Here is the code: In this line "if(analogRead(fotoresistori[i]) < 300)" we put 300 because with 0 etc. it did not work
int fotoresistori[] = {A0, A1, A2, A3, A4};
int verdi[] = {11, 10, 9, 8, 7};
int rossi[] = {6, 5 , 4, 3, 2};

void setup()
{
  pinMode(13, INPUT);
  pinMode(12, INPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  Serial.println(postiDisponibili);
  if(digitalRead(13) == HIGH){
    postiDisponibili++;
  }
  else if(digitalRead(12) ){
    postiDisponibili--;
  }
  for(int i = 0; i<5; i++){
    if(analogRead(fotoresistori[i]) < 300){
      digitalWrite(rossi[i], HIGH);
      digitalWrite(verdi[i], LOW);
    }else{
      digitalWrite(rossi[i], LOW);
      digitalWrite(verdi[i], HIGH);
    }
  }
  delay(500);
}

The value of A0 is always at 0.

You're not applying any voltage to the photoresistors and the other end is connected to earth so it will always be zero. You need to connect the analog end to +5v via a suitable current limiting resistor (suggest 10K for a typical photoresistor) then measure the voltage.

Ok thank you. I will try it now

I did this: https://i.imgur.com/gVTMa8A.png but the led still won't turn on. But thanks to you now the output of A0 is no longer stucked on 0.

Ok mate i did everything and i worked! At the end there was another error, but thanks for the advice

Glad you worked it out in the end


text:
Does the UNO R4 still have the standard on-board led on pin 13?
I need to add support for the UNO R4 (both models) for a library I'm maintaining. The library uses the LED on pin 13 as status indicator. I can't find any information whether that LED is still there on the R4 Minima and Wifi boards. The R4 Wifi has this nice LED matrix, so the other LED might be gone for it.

as always, it is LED_BUILTIN

The schematics for the R4 Minima and Wifi boards can be found at:  https://docs.arduino.cc/resources/schematics/ABX00080-schematics.pdf and https://docs.arduino.cc/resources/schematics/ABX00087-schematics.pdf .  Pin 13 is also labeled SCK. A LED is attached to this pin.


text:
STM32 "blue pill" st-flash error
I am trying to flash STM32 "blue pill" using arduino IDE as mentioned in the link https://www.onetransistor.eu/2017/11/stm32-bluepill-arduino-ide.html#no-bootloader
Basically using MX linux as OS.
The following is the response
user@mx:~/.arduino15/packages/stm32duino/tools/stm32tools/2021.5.31/linux/stlink
$ ./st-flash --reset write ~/Desktop/generic_boot20_pc13.bin 0x8000000
2021-07-27T09:20:21 INFO src/common.c: Loading device parameters....
2021-07-27T09:20:21 INFO src/common.c: Device connected is: F1 Medium-density device, id 0x20036410
2021-07-27T09:20:21 INFO src/common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
2021-07-27T09:20:21 INFO src/common.c: Attempting to write 22268 (0x56fc) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08005400 erased
2021-07-27T09:20:21 INFO src/common.c: Finished erasing 22 pages of 1024 (0x400) bytes
2021-07-27T09:20:21 INFO src/common.c: Starting Flash write for VL/F0/F3 core id
2021-07-27T09:20:21 ERROR src/common.c: unknown coreid, not sure what flash loader to use, aborting!: 2ba01477
2021-07-27T09:20:21 WARN src/common.c: Failed to write flash loader to sram!
2021-07-27T09:20:21 ERROR src/common.c: init_flash_loader() == -1
stlink_fwrite_flash() == -1
user@mx:~/.arduino15/packages/stm32duino/tools/stm32tools/2021.5.31/linux/stlink
$

I am not finding any src/common.c program in any of the subfolders, hence unable to dwell into details of the unknown core ID error
STlink V2 is providing proper response for st-info --probe as below
user@mx:~/.arduino15/packages/stm32duino/tools/stm32tools/2021.5.31/linux/stlink
$ ./st-info --probe
Found 1 stlink programmers
 serial: 4a3307000e144c37514d4e00
openocd: "\x4a\x33\x07\x00\x0e\x14\x4c\x37\x51\x4d\x4e\x00"
  flash: 131072 (pagesize: 1024)
   sram: 20480
 chipid: 0x0410
  descr: F1 Medium-density device
user@mx:~/.arduino15/packages/stm32duino/tools/stm32tools/2021.5.31/linux/stlink

Please let me know if you can find any method resolve this error

I recommend you https://www.stm32duino.com

Sure. Thanks for the website.


text:
How to connect LED lights for 3D Printed Robot
I'm new here and a newbie in electronics. I have a project to create a 3d printed robot with lights. I came across neopixels led's and the ardruino microcontrollers recently and find it to be a great possible sollution for what I need.
For my project, the 3d printed toy will have several parts that would need lights and I plan to use roughly over 40 LEDs connected to one source. I' m thinking of using the WS2812B LEDs.
I plan to use one neopixel ring for the robot's chest similar to Iron-Man's arch reactor.. While the head head will have 2x LEDs for the eyes, a smaller neopixel ring for the headpiece, another 2x LEDs for on the side of the robot mouth and 3x LEDs inside each vents on both sides of the robots head.
I need all the LEDs to turn on with a white light with a switch and turn red with another button. Although, I'd still be happy if they can only work with white.
For the power source, I was thinking about using a small powerbank or 2x 18650 batteries as the power source.
As mentioned, I'm very new to electronics and based on my research so far, i get confused really fast from all the jargons used and I'm not sure how to proceed.
Hopefully, i can get some answers here.
So.... My question is, is it possible to connect all the LEDs i plan to use on one microcontroller (ie: Ardruino Uno or Nano)
Most of the examples I can see on youtube are projects using LED strips. Are they diffrences in the way they are connected?
Another problem is coding for the ardruino..i'm totally clueless.
Any suggestions or help would be very much appreciated.

all of the LEDs on your robot are just one LED strip as far as connection and programming go

The key point for WS2812B LEDs is, that they can be daisy chained. This means, that everyone of them has one data input and 1 data output. If you connect the data output of one LED to the data input of the other, you created a short strip with 2 LEDs. Doing this multiple times creates a bigger LED strip. It's not relevant, if the LEDs are arranged into a physical strip, or arranged into complex forms. The LEDs are addressed by their position in the strip. The microcontroller sends a data stream to the first LED. It will read the first 3 bytes (1 byte per color) and forward the rest of the stream to it's data output, so to the next LED.
So you can wire all the LEDs on your robot in a way, that you basically only have 1 LED strip. In this case you only need 1 pin on your Arduino (plus Vcc and ground of course).
Or, if it's to cumbersome to wire all LEDs together, you can make multiple strips, divided by zones on your robot (like 1 strip for the face, 1 strip for the chest, ...). Every strip will need it's own pin on the Arduino.
Which way you go is your decision and also depends on how many pins you have free.

My question is, is it possible to connect all the LEDs i plan to use on one microcontroller (ie: Ardruino Uno or Nano)

Yes, one microcontroller is plenty enough for this. As I wrote, for 1 strip you only need 1 data pin.

Most of the examples I can see on youtube are projects using LED strips. Are they diffrences in the way they are connected?

This depends on what strips they have. If they use WS2812B strips, it is all the same. As said, the physical arrangement of the LEDs doesn't matter. But there are also other types of strips, for example the not-individually-addressable-single-color types, or the not-individually-addressable-RGB types (which often have one PWM line per color).

Another problem is coding for the ardruino..i'm totally clueless.

Have a look at the Adafruit Neopixel library or the FastLED library (both on github). They are libraries, that will hide most of the complexity from you and will make it easy to control the LEDs. They both have examples, that you can use to get started. Adafruit also has good tutorials for this. You can google them.

For the power source, I was thinking about using a small powerbank or 2x 18650 batteries as the power source.

I don't know, how much current these batteries can give you. I will leave that to you for your research. But be sure, that you can always provide the needed current. One WS2812B LED can draw up to 60mA (20mA per color), if you set them to full brightness white. So 40 WS2812B LEDs, can draw up to 2.4A. I guess, that your robot also has motors, which can also draw a big amount of current. So keep the total current draw in mind and don't ever try to draw this current through the Arduino (since this might fry the voltage regulator).


text:
How to program micro chips directly with USB
Is it possible to program chips like the Arduino uno's Atmega328P directly with USB serial from your computer?
Where can i find information on the protocols/standards to do such a thing?
More specifically, I want to be able to make a custom pcb for my Attiny85 chips with a usb connector. I would prefer not to use the arduino IDE.
Is it possible to program this chip like so?

The short answer is no.  The longer answer is maybe if you are willing to make some compromises.  USB is not a simple protocol and requires considerable hardware and software.  In a nut shell, the compromise will likely come in the form that much of your embedded processor's resources will be devoted to supporting the USB port.  Further you will likely have to handle programming the embedded processor similar to a field update or upgrade.  Much effort for small benefits.

Thanks for the helpful comment @st2000. Im not sure if you are familiar with the Digispark Attiny85. The serial usb pins are connected directly to the uC pins 2 and 3. Do you know how they achieved this?

If RS232 can be described in 4 or 5 sheets of type, then USB is so complex that it requires a book.  That said, you can just get by w/only software if you constrain your self to a simple USB peripheral type of a device.  Try reading this.

adafruit has attiny with usb bootloader https://cdn-learn.adafruit.com/downloads/pdf/introducing-trinket.pdf

@st2000 Your "short answer" should be posted as an answer. Stack Exchange considers this question unanswered right now, which looks bad for this site. I like your "answer" except it's not an answer. It's a comment, which is supposed to be used to get the OP to clarify what s/he wants.

https://learn.adafruit.com/introducing-trinket/starting-the-bootloader

Thanks @NickGammon.  I'll keep this in mind for the next one.  Majenko has done a good job covering this question.

Is it possible to program chips like the Arduino uno's Atmega328P directly with USB serial from your computer?

The bare chip? Generally, no.
Some chips that include USB hardware also may include a DFU bootloader in ROM. If your chosen chip has this, then yes you can - you just need to wire it up and use a suitable DFU firmware upload program to install your compiled code into the chip.
However chips that don't have USB will never have a USB DFU bootloader in them. In such cases is is your responsibility to create (or otherwise obtain) a suitable bootloader that you will install into the chip.
Digispark and Adafruit both do that.  They take a chip that doesn't have USB and install software that tries to (poorly) emulate USB over GPIO pins1.
For chips that do not have actual USB hardware in them it is far more common to use a UART-based bootloader - simply because this is a much lighter and more "correct" way of doing it.
If you want to use a direct USB connection for your device you should be selecting a chip that has USB built into it (AVR "U" series2, most PIC32, many ARM-based chips) which will allow you to have proper USB communication instead of slow HID and custom (non-standard) protocols only3.
Note that at no point does your choice of bootloader, or method of communication with the bootloader, tie you in to using the Arduino IDE.  The IDE just compiles the code then runs an external program that communicates with the bootloader (different bootloaders need different programs to communicate with them). How you compile the software is up to you. How you execute the bootloader upload program is up to you.

Personally I think that's a horrible idea and should NEVER be done. I'm a purist though.
Such as the ATMega32U4 used on the Leonardo and Micro boards.
VUSB can only (barely) run fast enough for USB 1.1. That means only HID protocols are officially supported (keyboard and mouse), and anything else is non-standard and requires special supporting software to work with it.

So what youre saying is if I really wanted to create a custom pcb with a usb connector to program, I can either add a UART to USB converter or choose a chip with built in usb?
Otherwise there is the slow HID software option... If i were to go with that option where can i find info on the software to do this?

That would be the normal way. Having a UART header on a board is more common than you'd think - even if you have USB available.

I think we are all thinking you should not sacrifice performance of the embedded processor by always supporting a USB port (even when you are not using it).  The real Arduino and it's knock offs use a support chip (FTDI or 2nd processor w/a USB port built in).  This only cost a few dollars if that and allows the embedded processor to run a minimal Arduino program to support down loading new applications.  (The cable in another answer is supposed to have the FTDI chip inside it.)  BTW, didn't I point you to the HAD article w/the HID project?  That's where you would go to learn more.

Is it possible to program chips like the Arduino uno's Atmega328P directly with USB serial from your computer?

Put a bootloader on the chip first, then an offboard USB/Serial adapter can be used for the serial programming.   That's basically what a ProMini is - a bootloaded '328P (in SMD form) with a resonator & decoupling caps and a small voltage regulator - and a header to accept an FTDI Basic for programming serially.  If you notice the Black and Green colors next to the FTDI header, those are to match the wire colors on the the FTDI cables that were originally used, before seperate USB cable and FTDI modules became more popular.
https://www.sparkfun.com/products/9718

Instead of the 6-pin FTDI header, you could make an adapter board to go from FTDI to a USB-A 5-pin connector, then on your board have a USB-B-Mini or USB-B-Micro 5-pin connector to bring in the FTDI's 5V, Gnd, DTR, Tx, and Rx signals.
USB wouldn't be coming in directly, but you would have the spacing advantage of the small USB connector, and could program serially from a PC USB port.
Too bad you don't want to use the Arduino IDE, there are supported core codes to add to the IDE for the Attiny85 and other chips like that. Attiny85 with bootloader could then be serially programmed with an offboard USB/Serial adapter.
https://github.com/SpenceKonde/ATTinyCore

ATtinyCore Universal
This core supports the following processors - essentially every ATtiny processor that makes sense to use with Arduino. Click the processor name for part-specific information:
ATtiny2313, 4313
ATtiny24, 44, 84 (With or without Optiboot bootloader)
ATtiny25, 45, 85 (With or without Optiboot bootloader)
ATtiny261, 461, 861 (With or without Optiboot bootloader)
ATTiny87, 167 (with or without Optiboot bootloader)
ATTiny48, 88 (With or without Optiboot bootloader)
ATTiny441, 841 (With or without Optiboot bootloader)
ATTiny1634 (With or without Optiboot bootloader)
ATTiny828 (With or without Optiboot bootloader)
ATtiny43 (no bootloader)

Thanks for your excellent answer. I will use the Arduino if it makes my life a whole lot easier. With the usb to FTDI cable you can directly program the Attiny with the help of the github link?

Yes, just add the cores to the IDE.  You will need a Programmer to put the Bootload code into the chip; The FTDI route can be used after that.  A Programmer connects to the Reset (2), SCK (7), MISO (6), and MOSI (5) pins to access the bootload memory area.

I can just use Arduino as programmer right? And programming the chip will automatically remove the previous bootloader from the chip if there is one?

Yes, you can use Arduino as ISP or whatever it's called these days.  I have an Atmel AVRISP MKii for a Programmer, so I don't need to fool around with loading a program into an Uno to use it as  a Programmer.