attiny | ATtiny microcontroller support for the Arduino IDE
kandi X-RAY | attiny Summary
kandi X-RAY | attiny Summary
This repo contains a set of "cores" which adds support for some members of the Atmel AVR ATtiny family of microcontroller to the Arduino IDE.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of attiny
attiny Key Features
attiny Examples and Code Snippets
Community Discussions
Trending Discussions on attiny
QUESTION
I created a small project that uploads C++ code to an Attiny85, for this I used arduino.
QuestionBut I would have liked to know if it was possible to download and run rust code in Attiny85 or other Attiny. If we can, how do we do it?
DetailsI found this GitHub repo to do this, but it is not explicit on how can export the rust code to Attiny. The GitHub repo in question: https://github.com/q231950/avr-attiny85-rust?ref=https://githubhelp.com
...ANSWER
Answered 2022-Feb-14 at 17:08C++ is cross-compiled to AVR machine code on your development host. What you are loading is not C++ code; that is the source code used to generate the machine executable binary code, which is what you load..
You can develop for AVR using any language for which a cross compiler exists. Rust is certainly such a language. This article discusses using Rust on Arduino Uno hardware.
Whether ATTiny85 with only 8Kb of Flash and 512 bytes of SRAM will support a Rust runtime environment and any useful code I cannot tell; I am not familiar with Rust's runtime requirements, but it does not seem like an efficient use of limited resources to me, and I would treat it as an academic challenge rather than a practical development approach. I would expect Rust to have a considerably larger run-time footprint than C or even C++.
QUESTION
I have an ATTiny85 which I program using a sparkfun programmer (https://www.sparkfun.com/products/11801) and the ATTiny Board Manager I am using is: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Below is my code, I am having trouble getting the interrupt to work when I ground Pin 2. I have tested the LED does work outside of the interrupt (inside the loop). Any suggestions are welcome.
...ANSWER
Answered 2021-Nov-16 at 04:27I see one possible error with your Boolean data type. Boolean data types are either true or false. I see that your using it for variable lastState. The initialization to equal 0 is something that I don't think the compiler allows. Maybe you should try setting the bool variable to the following...
QUESTION
I'm trying to build a small hygrometer based on the DHT11 and I'm having a bit of an "issue" with the code size. I want to run it on an Attiny45 and it's a wee bit too big (352 bytes too big to be exact). I am aware that I could just use an Attiny85 and have space to spare or don't use a bootloader and barely fit it in (94%) but I kind of want to make my life harder than it needs to be and figure out how to reduce size since it'll probably come in handy in the future. Treat it as a learning experience if you will.
What it's supposed to do:
- Read DHT11 input
- Display results on 2 two-digit 7-segment displays (so I guess 4 7-segments in total)
- Go to sleep most of the time to preserve battery
- Wake up every 8 seconds to update sensor values (without turning on the display)
- Wake up on a button press to display the values for humidity and temperature
Side note: 7-segments are adressed via two 74HC595s of which I am using 7 outputs each for the displays and 1 each for a transistor that connects the display in question to GND. There's a schematic at the bottom if you're interested.
As pointed out, my main issue is code size so if anyone has any tips on how to reduce that (or any other tips how to improve the code) please let me know.
I hope I'm asking the question properly, if not please let me know.
Compiler output:
...ANSWER
Answered 2021-Nov-09 at 12:55Okay so thanks to the input of Mat I tried substituting the DHT11 library with something more sleek, which took me a while to get up and running. I ended up using this as a base, edited around a bit and commented heavily for my benefit. I added my updated code below for anyone interested (thanks for pointing out the correct highlighting issue), there's also a github with the rest of the design files.
Seems the library is really heavy, as the compiler output shows:
Compiler output:
QUESTION
I am working on a project using an ATtiny 202 and I am nearly done with my programming, but I have run into a large problem. I can't create any ISRs, because I always get a compiler error.
I am using the newest version of MPLABX IDE (5.35) (yes it is for pic and avr mcus) and the second newest version of the xc8 compiler (v2.10). I cannot use the newest version of the compiler, because that is for some reason missing the device header for the ATtiny 202. (I had a different thread about that problem a while ago)
I have created the ISRs exactly like described in the XC8 Manual, and the IDE doesn't mark it as a problem either, but when I then try to compile the program I always get a compiler error. Here is one of my ISRs:
...ANSWER
Answered 2020-Aug-04 at 20:42Fixed:
I had posted this question on the microchip forum as well, as no one here seemed to be able to help.
So I figured out that the problem was that in the project properties under
XC8 Global Options -> XC8 Compiler -> Option categories: Preprocessing and messages
the option "Use CCI Syntax" was disabled. This needs to be enabled for the __interrupt to work.
QUESTION
I have an ATTiny that is supposed to receive commands over UART. I have a simple display of eight LEDs that should show the contents of the most recent byte received. I am using an interrupt to read data as it is received. No matter what data I send UDR always reads 0xFF
in the interrupt. I know the interrupt is being triggered since the display changes from 0x00
to 0xFF
, but it never displays the value I sent over the serial bus.
This is how I enable UART.
...ANSWER
Answered 2020-Aug-04 at 15:42There can be several problems with uart communication. First check some things:
- Is controller configured with the right clock?
- Internal/External
- Is F_CPU defined for ?
- Is BAUD defined for ?
- Are you using a controller like ATmega16 that has special register access?
- If you are using an external clock (that should not be devided) is CKDIV8 disabled in FUSES or in special registers at some controllers?
- Is:
- Baudrate,
- Paritybit,
- Stopbit setup corret on Transmitter and Receiver
Debug:
- If you are using a PC for communication, create a loopback at the UART adapter and check with a terminal (TeraTerm, Putty, ...) if the messages you send are received correctly.
- You also can enable the TX controller and check if loopback is working on your uC.
- If it is possible try to write the received data to some leds to check if some date is received
- Is GND betweend receiver and transmitter connected?
- Are the voltage levels between transmitter and receiver the same?
- Do transmitter and receiver have its own source? (Then do not connect VCC!)
- Check if the clock on the controller is correct (switch on an led with
_delay_ms()
function every second)
Example Program
QUESTION
I've just discovered the ATtiny84/85 chips and have ordered a few to use in some projects. I've looked high and low for all the support it has for programming through the Arduino IDE and Uno and have come across high-low tech's website and the supported arduino functions in that core.
Then I came across SpenceKonde's ATTinyCore which is another highly regarded core for the ATTiny series. The problem is that I can't find any information as to what classic Arduino functions this core supports. I mean like a list. I'm sure the basic functions are supported but how about using sleep mode / low power mode and a few other things. Is everything in the Arduino.h library supported?
Sorry if this is a silly question but a little help would be much appreciated.
...ANSWER
Answered 2020-Jul-14 at 15:24I have contacted DrAzzy a.k.a Spence Konde on the Arduino Forum regarding this matter and I'm going to quote his reply to me down below.
ATTinyCore (and my other cores) implements all of the standard Arduino API functions that are logically coherent for the hardware in question. Everything should work, even the stuff that I think is a dumb idea (eg, SerialEvent, yield()) - if it doesn't, it should be reported to me as a bug. There are only a few places where I knowingly departed from the official Arduino behavior
Stuff that isn't arduino API, like the stuff that's included with avrlibc, has no dependence on the core whatsoever. If the hardware supports it, those libraries should work. If it fails to compile with the library (or a specific call in the library) in the sketch (generally giving either a #error saying it's unsupported, or an "undefined reference" to a register or bit name - actually calling it at a sensible time or uploading and verifying it behaves the way you want is usually unnecessary)
Hope this helps you guys. Thanks again to Spence Konde (DrAzzy) for the amazing ATTinyCore and his help in this matter.
QUESTION
I am new to programming microcontrollers and I've just started using Attiny85. I am trying to build a circuit for LED with tactile switch. Every time the tactile switch is pressed it jumps the LED to next state of operation. Since it is battery operated, when the LED is OFF I want the attiny 85 to consume as low current as possible. As of now it is consuming 4mA when the LED is OFF without sleep mode. So I tried the power down mode for Attiny 85 but some how i am stuck in the power down mode
...ANSWER
Answered 2020-Jan-29 at 14:35Please refer to the datasheet, section 7.1 Sleep Modes at page 34.
In the table you can see, in Power-down mode only 3 sources can wake up the CPU:
- INT0, only level interrupt and pin change interrupt
- USI module start condition
- Watchdog interrupt
That means, if you want the part to wake up when button has been pressed, then best option will be to configure the pin change interrupt.
First you need to configure an interrupt service routine (ISR). The ISR is required just to handle the interrupt event, without it the program will be restarted. Since there is no action required, the ISR can be empty:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install attiny
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page