Open liamwheat opened 5 months ago
After a quick look at your wiring diagram, I can see that on the Attiny85, the MISO and MOSI pins have been swapped around.
I used the below image, however I have found what you're saying on other attiny 85 images that perhaps the image I've used was incorrect. I will try swapping and let you know!
You need to check the datasheet for your specific Attiny to make sure.
Hi i have now confirmed the pins for my attiny85 and rewired accordingly. However still no luck for me i'm afraid. Does the code look all good to you? I've also attached a picture how im powering it, the same as your video 2, 3v coin cells. Just wanted to check it looks alright with the capacitors.
Also for my single button -- I want to command an input of "LCTRL+e"repeated 3 times, when pressed once. would you be able to help me with that? the normal LCTRL + e part i have used your method for and tweaked the index, but the repeat part im not sure how to do.
Best regards
CE
and CSN
pins are incorrectly specified. According to your breadboard image, CE_PIN
should be 3, and CSN_PIN
should be 4.initButtons()
function line 64, buttonObjs[i] = new Button(btnInfo.btnPin, DEBOUNCE_MS);
.If none of these changes work, try point 1, which might just be the issue.
So, I got some Attiny84's to try out. I've now made the exact same circuit with 3 buttons, and code exactly as yours. Unfortunately no luck for me yet. I can't think im doing wrong
For the uploading of the code I'm using an ardiuno UNO as ISP and below is my method:
-First I connect my Arduino UNO on its own and do the following in the Arduino software: 1.File, examples, ArdiunoISP,
-Then I attach my micro-controller to the UNO,
As for the function line 64, I had to delete it as it always created an error code and would not let me upload the code with that line.
With the ce and csn pins im now using same code unchanged with same button layout.
Not sure where im going wrong this time.
Removing line 64 will for sure make the code not work, so if this has been the case then that might very well be the core of the issue. Can you just upload anything you know that will work to the Attiny so you can confirm everything else is good to go, could be a simple blinking LED example. Once you have tested and confirmed this, upload the code with line 64 and lets see what error you are getting.
I uploaded the blink code which worked with my Attiny85 so i can confirm everryhting else seems good, However I have indeed had this line 64 of code removed on both my Attiny 85 and Attiny 84 tests.
I will get a sceenshot of the error for you soon.
Thanks so much!
Hello, sooo.. here I have copied the error I am getting and a screenshot of the highlighted line 64. the code has not been edited it is copied directly from your project. Hopefully this could give us an idea as to whats going wrong for me? Kind regards.
Below is the error messages:
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno" C:\Users\liam_\OneDrive\Documents\Arduino\Attiny_84_transmitter_code\Attiny_84_transmitter_code.ino: In function 'void initButtons()':
Attiny_84_transmitter_code:64:63: error: no matching function for call to 'Button::Button(int&, const uint16_t&)'
buttonObjs[i] = new Button(btnInfo.btnPin, DEBOUNCE_MS);
^
In file included from C:\Users\liam_\OneDrive\Documents\Arduino\Attiny_84_transmitter_code\Attiny_84_transmitter_code.ino:4:0:
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:14:3: note: candidate: Button::Button(uint8_t)
Button(uint8_t pin);
^~
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:14:3: note: candidate expects 1 argument, 2 provided
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:11:7: note: candidate: constexpr Button::Button(const Button&)
class Button
^~~~~~
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:11:7: note: candidate expects 1 argument, 2 provided
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:11:7: note: candidate: constexpr Button::Button(Button&&)
C:\Users\liam_\OneDrive\Documents\Arduino\libraries\Button/Button.h:11:7: note: candidate expects 1 argument, 2 provided
exit status 1
no matching function for call to 'Button::Button(int&, const uint16_t&)'
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
Have you installed the Button
library by Michael Adams?
Sorry for slow reply, I've been on leave.
Yes i've just double checked and i can confirm button library by Micheal adams is installed
I have noticed that in your video button library shows orange in colour, mine is however grey. Comparison below. Does this colour difference indicate mine is not linked/working properly?
Okay ive just managed to link the library and its now orange. Now when attempting to verify the code to upload i get alot of errors associated with SPI.
Small snipit of the error below:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:310:55: error: 'SPIE' was not declared in this scope inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); } C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:310:55: note: suggested alternative: 'ACIE' exit status 1 Error compiling for board ATtiny24/44/84.
Could it be that the SPI library is not installed? where did you install/ find this library?. I do have the RF24 library installed as I followed your video, however SPI library installation was not covered.
As always kind regards and thankyou for checking
Are you changing the Tools>Programmer to USBasp (ATTinyCore)
and selecting Attiny84 no bootloader as the microcontroller in the Arduino IDE? Are you using this ATTinyCore board manager?
My method for uploading the code is a bit earlier in our discussion, I used the arduino uno as ISP. Have a quick check back, as I've put step by step my actions by the book I believe. I do have an USBasp adapter, but it was requiring more and more things to upload the code, so I went with the arduino uno solution following this guide:
https://www.youtube.com/watch?v=dtPGMTBdDoA&ab_channel=AhmadLogs
The issue is with the micro-controller selection and upload, I have not uploaded code to the Attiny in that way so I can't help in that regard.
Would you be able to provide a guide on how you uploaded your code onto the attiny using the USBasp.? I do own one, but I've searched hard to find a concrete method but not sure how to do it. If you could give me a stepped guide including components i could give it a go. kind regards and as always thankyou for your support so far
The instructions for that is in the readme of this repository, found here
Hello So to summarize, I am attempting to make an identical keyboard to the one beautifully crafted by ProjectsWithRed, Mine however will feature only a single button and uses all the exact same components apart from the ATtiny84 as I am using the smaller ATtiny85 instead!
I have therefore used the same code and libraries and adjusted the wiring and code (pins and input commands) for my single button which I want to command an input of "LCTRL+e"repeated 3 times. when pressed once.
To my knowledge I followed as carefully as possible all steps involved however testing the button I had no luck. As mentioned I have used all the same parts, apart from using the smaller Attiny85 and single button.
Included in my post here I have attached my circuit diagrams and my code which I uploaded to the transmitter and receiver. also when uploading the code to the Attiny85 i used an Arduino uno as ISP, and followed online guides as to how to correctly upload code to the Attiny with this method. I believe I did this correctly.
Hopefully ProjectsWithRed can help me with this and anyone else looking to do similar can also see the fix.
*sidenote, my code for the buttons command is currently set as {{5, "128 101"}, (pin 5, LCTRL e) I am aware this currently does not include the repeat function i wish to add so that the single press of the button will cause it to loop/repeat 'LCTRL +e' 3 times. I am unsure of how to do that and so need help with this. But for now the problem stands, I cannot get it to show any command. It could be a wiring issue --perhaps I've made an error with the ATtiny pins I've used for the button and transmitter, or perhaps my code adjustments are incorrect.
Your help is greatly appreciated.
attiny85 transmittrer code.txt
Promiccro reciever code.txt
### Attiny transmitter code:
Pro-micro receiver code: