Trinket, DHT11, and RC-Switch

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
languer
 
Posts: 102
Joined: Fri May 17, 2013 2:02 pm

Trinket, DHT11, and RC-Switch

Post by languer »

Has anyone gotten the Trinket (+3.3V or +5V) to work with both the DHT library and the RC-SWITCH libraries simultaneously? I can used them individually on the Trinket, but once I tried to use them both on the same sketch the Trinket sort of gets lost in the weeds. I think I am using either to much code space and/or too much memory I tried to use the simple rc-switch example (that requires no library) and everything worked. Using both the DHT11 and RC-SWITCH libraries, both the code space and ram space seem tight but under the maximum, yet I have a feeling that is where the problem lies.

User avatar
languer
 
Posts: 102
Joined: Fri May 17, 2013 2:02 pm

Re: Trinket, DHT11, and RC-Switch

Post by languer »

In case anyone else ever has this problem, this is how I solved it.

After removing all the receiver-related code from the rc-switch library I managed to reduce the program size by over 1kb, and the RAM usage by over 150bytes.

Below is a summary of my numbers:
  • Full DHT and full RC-Switch libraries: 4,474 bytes (84%) of program storage space; 203 bytes of dynamic memory
  • Modified DHT library (removed all sensors except DHT11) and full RC-Switch library: 4,298 bytes (80%) of program storage space; 203 bytes of dynamic memory
  • Full DHT library and modified RC-Switch library (removed receiver code): 3,382 bytes (63%) of program storage space; 43 bytes of dynamic memory
  • Modified DHT library and modified RC-Switch library: 3,204 bytes (60%) of program storage space; 43 bytes of dynamic memory
I went with the full DHT library and the modified RC-Switch library and now the Trinket operates properly.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”