Electronics > Beginners

Attiny85: no serial output?

<< < (4/6) > >>

westfw:
Sleemanj: how’d you wind up with all that “core” code in an optiboot fork?

sleemanj:

--- Quote from: westfw on January 25, 2020, 09:37:33 am ---Sleemanj: how’d you wind up with all that “core” code in an optiboot fork?

--- End quote ---

Ostensibly because the original purpose was principally as a distribution of my optiboot fork.  As is common with this sort of thing, it grew a bit. 

phennessey:
Here's my setup:

   Rotary encoder with A/B pins connected to pins 2/3 on the attiny85
   All attiny pins connected to Tiny AVR Programmer with jumpers
   Attiny clock set to 8mhz



Here's some sample code I tried -- not to interface with the encoder, just to get the chip to send a simple serial signal so I could confirm whether it even could work at all, so I found this code in another forum:


--- Code: ---#include <SoftwareSerial.h>

SoftwareSerial Serial(3, 4);

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

void loop() {
  Serial.println("Hello World!"); //Print this once every second.
  delay(1000);
}
--- End code ---

When I open the serial monitor, I see no activity. I tried different pins, different baud rates, different MHz settings (1 and 8, no higher!). Still...nothing.

I have another project (called RGB_trig) where I use the rotary encoder (successfully, I might add!) to adjust an RGB LED. When I try to combine this serial setup with the code (even just the #include at the top) and include a serial.println to be called when the rotary encoder triggers, I get this error:


--- Code: ---libraries/SoftwareSerial/SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_2'
sketch/RGB_trig.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
Multiple libraries were found for "SoftwareSerial.h"
 Used: /Applications/Utilities/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial
exit status 1
Error compiling for board ATtiny25/45/85.
--- End code ---

Why can't it compile all of a sudden? I don't have multiple libraries of SoftwareSerial.h. I checked that directory, and it's just one file. Is this because I have an interrupt set up for the encoder? I use an interrupt so that I don't have to rely on a loop to adjust the LED brightness. Let me know if you all need to see my code for this.

Thoughts? All I want to do is trigger a serial print output when the switch is triggered so I can study its output and determine if it needs to be debounced.

sleemanj:

--- Quote from: phennessey on January 27, 2020, 04:17:07 am ---Here's my setup:

--- End quote ---

Do you actually have a USB Serial adapter connected?   

I think you may be perhaps thinking your programmer can do that, which is unlikely.

You should disconnect your programmer, and connect a USB Serial adapter (UART, not RS232 of course) in order to talk/listen to your chip over serial after programming.




--- Quote ---Is this because I have an interrupt set up for the encoder?

--- End quote ---

Yes both SoftwareSerial and your own code are trying to use the same interrupt, which is no good.

phennessey:
Crap.

I thought this thing was more capable...guess not. Looks like I’ll be getting a separate serial adapter!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod