Author Topic: Help! Before I have an aneurism  (Read 8140 times)

drewintoledo

  • Newbie
  • *
  • Posts: 1
Help! Before I have an aneurism
« on: January 21, 2016, 05:27:05 pm »
I have a digispark that I bought years ago when they first came to market.

I'm trying to "port" a program to control an addressable RGB led strip from an old Arduino to this smaller digispark.

I can't seem to get it.   The sketch and error is below, can anyone push me in the right direction?


=====SKETCH=============
#include "FastLED.h"

#define NUM_LEDS 50
#define DATA_PIN 1
CRGB leds[NUM_LEDS];

void setup() { .
      FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}
======RESULTS===============

Arduino: 1.6.7 (Windows 7), Board: "Digispark (Default - 16.5mhz)"

WARNING: Category '' in library SPI is not valid. Setting to 'Uncategorized'
Warning: platform.txt from core 'Digistump AVR Boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
Warning: platform.txt from core 'Digistump AVR Boards' contains deprecated recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm, automatically converted to recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{archive_file_path}" "-L{build.path}" -lm. Consider upgrading this core.
C:\Program Files (x86)\Arduino\libraries\FastLED_Master\FastLED.cpp: In member function 'void CFastLED::delay(long unsigned int)':

C:\Program Files (x86)\Arduino\libraries\FastLED_Master\FastLED.cpp:125:9: error: 'yield' was not declared in this scope

   yield();

         ^

exit status 1
Error compiling.
Invalid library found in C:\Users\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.5\libraries\Digispark_Examples: C:\Users\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.5\libraries\Digispark_Examples
Invalid library found in C:\Users\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.5\libraries\Digispark_Examples: C:\Users\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.5\libraries\Digispark_Examples

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Pinus

  • Newbie
  • *
  • Posts: 35
Re: Help! Before I have an aneurism
« Reply #1 on: January 21, 2016, 11:22:35 pm »
It means that probably the library you are trying to use doesn't compile because it is either too old and uses deprecated instructions, or was meant for different hardware. You either find a library that works with your hardware today (and not, say, in 2010), or find someone who is willing to work for free to fix yours. There are nutters out there who will do it. Good luck.

DeuxVis

  • Full Member
  • ***
  • Posts: 107
Re: Help! Before I have an aneurism
« Reply #2 on: January 25, 2016, 05:10:59 am »
To point you in the right another direction, with a digispark I'd use the adafruit neopixel library to control those WS2812 leds.

See the code at the bottom of this wiki entry for a couple of demos : http://digistump.com/wiki/digispark/tutorials/digiled


Edit : It seems that FastLED library is working on digispark. See http://digistump.com/board/index.php/topic,1931.0.html
And for reference to FastLED : http://fastled.io/
« Last Edit: January 25, 2016, 05:21:04 am by DeuxVis »

alchemix

  • Newbie
  • *
  • Posts: 1
Re: Help! Before I have an aneurism
« Reply #3 on: February 14, 2016, 12:57:25 pm »
Using the FastLED library (V3.1.1)  with the Digistump AVR Boards (V1.6.7) of the Arduino IDS (V1.6.7) I had the same error: FastLED.cpp:125:9: error: 'yield' was not declared in this scope

Commenting out the line 125 in the file FastLED.cpp solved this problem for me  on the quick:

#if defined(ARDUINO) && (ARDUINO > 150)
//      yield();
#endif

I had not yet time to analyze the problem in depth.
« Last Edit: February 15, 2016, 11:50:12 am by alchemix »

Jr_sc

  • Newbie
  • *
  • Posts: 4
Re: Help! Before I have an aneurism
« Reply #4 on: February 18, 2016, 04:55:40 am »
FWIW I had issues getting fastled to work as well as Arduino 1.6.7.  Long story short I am using Arduino 1.6.5 and WS2812.h with good results - may not be a feature-rich / fast but sure beats an aneurism!

Reading this thread it looks like it doesn't work w/ATTiny85 save for trinket https://github.com/FastLED/FastLED/issues/46
« Last Edit: February 18, 2016, 05:01:28 am by Jr_sc »

CaptObvious

  • Newbie
  • *
  • Posts: 1
Re: Help! Before I have an aneurism
« Reply #5 on: December 18, 2016, 01:15:42 pm »

Commenting out the line 125 in the file FastLED.cpp solved this problem for me  on the quick:

#if defined(ARDUINO) && (ARDUINO > 150)
//      yield();
#endif

I had the same error in Arduino IDE 1.6.12, but instead of commenting out the yield(); I decided to "selectively" comment it out just for AT Tiny 85 boards. I added
&& !defined(__AVR_ATtiny85__)

This solution shouldn't disrupt my other projects that use the ESP8266.

shutterbug-photo

  • Newbie
  • *
  • Posts: 1
Re: Help! Before I have an aneurism
« Reply #6 on: March 24, 2017, 08:10:17 am »
Here's a better fix than commenting out the one line (which may be useful in some libraries where a scheduler is implemented.) Create a file called hooks.c in the digistump\hardware\avr\1.6.7\cores\tiny directory with the below content. If nothing hooks the yield() function, it's basically a NOP. But if some other library actually does use that hook, it's there and fastled will benefit from its presence.

/*
  Copyright (c) 2012 Arduino.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/**
 * Empty yield() hook.
 *
 * This function is intended to be used by library writers to build
 * libraries or sketches that supports cooperative threads.
 *
 * Its defined as a weak symbol and it can be redefined to implement a
 * real cooperative scheduler.
 */
static void __empty() {
   // Empty
}
void yield(void) __attribute__ ((weak, alias("__empty")));

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Help! Before I have an aneurism
« Reply #7 on: April 07, 2017, 07:37:48 pm »
@shutterbug-photo Not quite! Copying in the hooks.c from the standard AVR core into the digispark/tiny core will do absolutely nothing, as the standard core doesn't actually reference it directly at present. Instead, it is declared in the Arduino.h file in the standard AVR core at #38 as being void yield(void);

In the case of the digispark core, since it is still doing the Arduino.h -> WProgram.h redirect from pre 1.5.0 Arduino core days, I would add that function prototype to WProgram.h. Adding the hooks.c file is not strictly necessary for the code to successfully compile, but it should be added for the sake of completeness.
« Last Edit: April 07, 2017, 07:41:47 pm by PeterF »