avr/pgmspace.h

I have tried to find a downloadable zip for the above to install library avr/pgmspace.h but I can't find a download anywhere, can anyone help please.
I am using UNO r3 with 1.5.6-r2. Spent all morning but nothing I have tried is successful.

Arduino 1.5.6 is a BETA-TEST version with special support for the DUE and YUN. It does not work well with regular Arduinos.

For the regular Arduinos use Arduino 1.0.6 which includes the AVR libraries.

In my opinion, the 1.5.8 BETA is also better for normal Arduino boards. It has less trouble with Java and better virtual serial port detection.

Please do not use the 1.5.6 BETA, it is improving with every version, so you have to use the newest version.

The pgmspace is part of the AVR libraries. It is already included with the Arduino IDE.
All you have to do is this: #include <avr/pgmspace.h>

Here is some explanation : PROGMEM - Arduino Reference
I think that is no longer needed to include the pgmspace.h for PROGMEM.

Here is the file itself : avr-libc: <avr/pgmspace.h>: Program Space Utilities

What kind of special function do you want to use ? Try to use that function without including the pgmspace.h

HI, Many thanks for help, I have downloaded and installed as suggested 1.5.8.
The sketch is by Glen Popiel in his book.
I now get error messages.

[code]
// Modified and added LCD display by Glen Popiel - KW5GP

/*
  Uses MORSE ENDECODER Library by raronzen
  Copyright (C) 2010, 2012 raron
  GNU GPLv3 license (http://www.gnu.org/licenses)
  Contact: raronzen@gmail.com  (not checked too often..)
  Details: http://raronoff.wordpress.com/2010/12/16/morse-endecoder/
*/

#include <avr/pgmspace.h>
#include <MorseEnDecoder.h>  // Morse EnDecoder Library
#include <Wire.h>    //I2C Library
#include <LiquidCrystal.h>  // Liquid Crystal Library
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
#define morseInPin 2
#define Speed_Pin A0



String text;  // Variable to hold LCD scrolling text
char cw_rx;  // Variable for incoming Morse character
int read_speed;  // Variable for desired CW speed setting
int current_speed=-1;  // variables to track speed pot

morseDecoder morseInput(morseInPin, MORSE_KEYER, MORSE_ACTIVE_LOW);  // Define the Morse objects



void setup()
{
  
  lcd.begin(20, 4);
  lcd.print("KW5GP CW Decoder");
  delay(3000);
  lcd.clear();
}  // End Setup Loop


void loop()
{
  read_speed = map(analogRead(Speed_Pin),10,1000,5,35);  // Read the potentiometer to determine code speed
  if (current_speed != read_speed)  // If the Speed Pot has changed, update the speed and LCD
  {
    current_speed = read_speed;  // Set the current speed to the desired speed
    morseInput.setspeed(read_speed);  // Call the set speed function
    text = String(current_speed) + " wpm";  // set up the LCD display with the current speed
    lcd.clear();  // Clear the LCD
    lcd.setCursor(5, 0);  // Set the cursor to 5,1
    lcd.print(text);  // Display the CW text
    text = "";
  }
  
  morseInput.decode();  // Decode incoming CW

  if (morseInput.available())  // If there is a character available
  {
    cw_rx = morseInput.read();  // Read the CW character
    
  //  Display the incoming character - Set the text to display on line 0 only. 
  if (text.length() >15)  // When length = 15, trim and add to new character so display appears to scroll left
  {
    text = text.substring(1,16);  // Drop the First Character
  }
  text = text + cw_rx;  // Set up the text to display on the LCD
  lcd.setCursor(2, 1);  // Set the cursor to 0,0
  lcd.print(text);  // Display the CW text
  }
}  // End Main Loop

[/code]

error messages:

Arduino: 1.5.8 (Windows 7), Board: "Arduino Uno"

Build options changed, rebuilding all

Using library MorseEnDecoder in folder: C:\Arduino Sketches\libraries\MorseEnDecoder (legacy)

Using library Wire in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire 

Using library LiquidCrystal in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal 



C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=158 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Arduino Sketches\libraries\MorseEnDecoder -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src C:\Users\ROGERA~1\AppData\Local\Temp\build8544120375074826940.tmp\CW_Decoder.cpp -o C:\Users\ROGERA~1\AppData\Local\Temp\build8544120375074826940.tmp\CW_Decoder.cpp.o 

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=158 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Arduino Sketches\libraries\MorseEnDecoder -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src -IC:\Arduino Sketches\libraries\MorseEnDecoder\utility C:\Arduino Sketches\libraries\MorseEnDecoder\MorseEnDecoder.cpp -o C:\Users\ROGERA~1\AppData\Local\Temp\build8544120375074826940.tmp\MorseEnDecoder\MorseEnDecoder.cpp.o 

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,
                 from C:\Arduino Sketches\libraries\MorseEnDecoder\MorseEnDecoder.h:7,
                 from C:\Arduino Sketches\libraries\MorseEnDecoder\MorseEnDecoder.cpp:58:
C:\Arduino Sketches\libraries\MorseEnDecoder\MorseEnDecoder.cpp:69:19: error: variable 'morseTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char morseTable[] PROGMEM = "*5*H*4*S***V*3*I***F***U?*_**2*E*&*L\"**R*+.****A***P@**W***J'1* *6-B*=*D*/"
                   ^
Error compiling.

Can anyone help me please, as I am now out of my depth. Many Thanks

Thanks for the full error message 8) Normally we are just guessing what kind of error someone has.

The new version 1.5.8 BETA has a few changes.
Every PROGMEM variable should have the word 'const' in front of it. And the type prog_uchar and prog_int are no longer used.

Can you change the file : C:\Arduino Sketches\libraries\MorseEnDecoder\MorseEnDecoder.cpp
Look at line 58 or near that line for "morseTable[]" and add 'const' in front of it.
Old : char morseTable[] PROGMEM = " ...
New :
</mark> <mark>const</mark> <mark>
char morseTable[] PROGMEM = " ...

The good thing is, that when you return to version 1.0.6, it still works.

Test: I used the Beta code Morse_EnDecoder_2012.11.25.tar.gz from here : Google Code Archive - Long-term storage for Google Code Project Hosting.
Added that word 'const', and the sketch in your post did compile.

Thanks Peter, it now works a treat.

Hello,

I have the same problem, I can't get avr/pgmspace.h
thecode is as follow

ple.

    /*
          8x8 LED Matrix MAX7219 Scrolling Text
              Android Control via Bluetooth
       by Dejan Nedelkovski, www.HowToMechatronics.com
       Based on the following library:
       GitHub | riyas-org/max7219  https://github.com/riyas-org/max7219
    */
    #include <MaxMatrix.h>
    #include <SoftwareSerial.h>
    #include <avr/pgmspace.h>
    PROGMEM const unsigned char CH[] = {
      3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
      .../...
    };
    int dIn = 7;   // DIN pin of MAX7219 module
    int clk = 6;   // CLK pin of MAX7219 module
    int cs = 5;    // CS pin of MAX7219 module
    int maxInUse = 2;    // Number of MAX7219's connected
    MaxMatrix m(dIn, cs, clk, maxInUse);
    SoftwareSerial Bluetooth(8, 7); // Bluetooth
    byte buffer[10];
    char incomebyte;
    int scrollSpeed = 100;
    char text[100] = "HowToMechatronics.com  "; // Initial text message
    int brightness = 15;
    int count = 0;
    char indicator;
    void setup() {
      m.init(); // MAX7219 initialization
      m.setIntensity(brightness); // initial led matrix intensity, 0-15
      Bluetooth.begin(38400); // Default communication rate of the Bluetooth module
    }
    void loop() {
      // Printing the text
      printStringWithShift(text, scrollSpeed);
      
      if (Bluetooth.available()) {   // Checks whether data is comming from the serial port
        indicator = Bluetooth.read();   // Starts reading the serial port, the first byte from the incoming data
        // If we have pressed the "Send" button from the Android App, clear the previous text
        if (indicator == '1') {
          for (int i = 0; i < 100; i++) {
            text[i] = 0;
            m.clear();
          }
          // Read the whole data/string comming from the phone and put it into text[] array.
          while (Bluetooth.available()) {
            incomebyte = Bluetooth.read();
            text[count] = incomebyte;
            count++;
          }
          count = 0;
        }
        // Adjusting the Scrolling Speed
        else if (indicator == '2') {
          String sS = Bluetooth.readString();
          scrollSpeed = 150 - sS.toInt(); // Milliseconds, subtraction because lower value means higher scrolling speed
        }
        // Adjusting the brightness
        else if (indicator == '3') {
          String sB = Bluetooth.readString();
          brightness = sB.toInt();
          m.setIntensity(brightness);
        }
      }
    }
    void printCharWithShift(char c, int shift_speed) {
      if (c < 32) return;
      c -= 32;
      memcpy_P(buffer, CH + 7 * c, 7);
      m.writeSprite(32, 0, buffer);
      m.setColumn(32 + buffer[0], 0);
      for (int i = 0; i < buffer[0] + 1; i++)
      {
        delay(shift_speed);
        m.shiftLeft(false, false);
      }
    }
    void printStringWithShift(char* s, int shift_speed) {
      while (*s != 0) {
        printCharWithShift(*s, shift_speed);
        s++;
      }
    }
    void printString(char* s)
    {
      int col = 0;
      while (*s != 0)
      {
        if (*s < 32) continue;
        char c = *s - 32;
        memcpy_P(buffer, CH + 7 * c, 7);
        m.writeSprite(col, 0, buffer);
        m.setColumn(col + buffer[0], 0);
        col += buffer[0] + 1;
        s++;
      }
    }

and I have alot of errors(see the attached file).

Thankyou very much
Franck

scrollingMatrix.txt (3.37 KB)

pgmspace should be part of the standard install.
Your error log does NOT include any complaints about pgmspace.
Some of the errors are merely warnings, which you normally wouldn't get unless you have them specifically enabled in the preferences.
Most (all?) of the actual errors are with the maxmatrix library, which does not seem to be getting compiled and linked properly. Make sure your installation of this is up-to-date.

Thank you very much
Franck