sammy | Posted: 25 Dec 2019, 09:45 AM |
---|---|
Member Posts: 1 Joined: 25-December 19 |
Dear - How to fix the Code Error in Arduino. It's showing me such a kind of error, pasted below : ************************************************************************* C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino: In function 'void sendPitchBendRange()': 2attiny85:11:3: error: 'uchar' was not declared in this scope uchar pitchBendRange[8] = {0x0B, 0xB0, 101, 0, 0x0B, 0xB0, 100, 0}; ^~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:11:3: note: suggested alternative: 'char' uchar pitchBendRange[8] = {0x0B, 0xB0, 101, 0, 0x0B, 0xB0, 100, 0}; ^~~~~ char 2attiny85:12:11: error: 'usbInterruptIsReady' was not declared in this scope while (!usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:12:11: note: suggested alternative: 'noInterrupts' while (!usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ noInterrupts 2attiny85:13:5: error: 'wdt_reset' was not declared in this scope wdt_reset(); ^~~~~~~~~ 2attiny85:14:5: error: 'usbPoll' was not declared in this scope usbPoll(); ^~~~~~~ 2attiny85:16:19: error: 'pitchBendRange' was not declared in this scope usbSetInterrupt(pitchBendRange, 8); ^~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:16:19: note: suggested alternative: 'sendPitchBendRange' usbSetInterrupt(pitchBendRange, 8); ^~~~~~~~~~~~~~ sendPitchBendRange 2attiny85:16:3: error: 'usbSetInterrupt' was not declared in this scope usbSetInterrupt(pitchBendRange, 8); ^~~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:16:3: note: suggested alternative: 'detachInterrupt' usbSetInterrupt(pitchBendRange, 8); ^~~~~~~~~~~~~~~ detachInterrupt 2attiny85:18:11: error: 'usbInterruptIsReady' was not declared in this scope while (!usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:18:11: note: suggested alternative: 'noInterrupts' while (!usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ noInterrupts 2attiny85:19:5: error: 'wdt_reset' was not declared in this scope wdt_reset(); ^~~~~~~~~ 2attiny85:20:5: error: 'usbPoll' was not declared in this scope usbPoll(); ^~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino: In function 'int main()': 2attiny85:29:3: error: 'uchar' was not declared in this scope uchar i; ^~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:29:3: note: suggested alternative: 'char' uchar i; ^~~~~ char 2attiny85:30:10: error: expected ';' before 'sentPBR' uchar sentPBR =0; ^~~~~~~ 2attiny85:31:10: error: expected ';' before 'calibrationValue' uchar calibrationValue; ^~~~~~~~~~~~~~~~ 2attiny85:32:10: error: expected ';' before 'midiMsg' uchar midiMsg[8]; ^~~~~~~ 2attiny85:43:3: error: 'calibrationValue' was not declared in this scope calibrationValue = eeprom_read_byte(0); /* calibration value from last time */ ^~~~~~~~~~~~~~~~ 2attiny85:47:3: error: 'usbDeviceDisconnect' was not declared in this scope usbDeviceDisconnect(); ^~~~~~~~~~~~~~~~~~~ 2attiny85:48:7: error: 'i' was not declared in this scope for(i=0;i<20;i++){ /* 300 ms disconnect */ ^ 2attiny85:51:3: error: 'usbDeviceConnect' was not declared in this scope usbDeviceConnect(); ^~~~~~~~~~~~~~~~ 2attiny85:53:14: error: 'WDTO_1S' was not declared in this scope wdt_enable(WDTO_1S); ^~~~~~~ 2attiny85:53:3: error: 'wdt_enable' was not declared in this scope wdt_enable(WDTO_1S); ^~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:53:3: note: suggested alternative: 'mutable' wdt_enable(WDTO_1S); ^~~~~~~~~~ mutable 2attiny85:55:3: error: 'usbInit' was not declared in this scope usbInit(); ^~~~~~~ 2attiny85:60:32: error: 'sentPBR' was not declared in this scope if ((PINB & 1<<PB4)==0 && !sentPBR) { ^~~~~~~ 2attiny85:65:5: error: 'wdt_reset' was not declared in this scope wdt_reset(); ^~~~~~~~~ 2attiny85:66:5: error: 'usbPoll' was not declared in this scope usbPoll(); ^~~~~~~ 2attiny85:67:8: error: 'usbInterruptIsReady' was not declared in this scope if(usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:67:8: note: suggested alternative: 'noInterrupts' if(usbInterruptIsReady()){ ^~~~~~~~~~~~~~~~~~~ noInterrupts 2attiny85:74:9: error: 'i' was not declared in this scope i=0; ^ 2attiny85:76:11: error: 'midiMsg' was not declared in this scope midiMsg[i++]= 0x09; ^~~~~~~ 2attiny85:81:11: error: 'midiMsg' was not declared in this scope midiMsg[i++]= 0x08; ^~~~~~~ 2attiny85:87:11: error: 'midiMsg' was not declared in this scope midiMsg[i++]= 0x0E; ^~~~~~~ 2attiny85:94:25: error: 'midiMsg' was not declared in this scope usbSetInterrupt(midiMsg, i); ^~~~~~~ 2attiny85:94:9: error: 'usbSetInterrupt' was not declared in this scope usbSetInterrupt(midiMsg, i); ^~~~~~~~~~~~~~~ C:\Users\shyan\OneDrive\Desktop\arduino\attiny85\1attiny85.ino\2attiny85\2attiny85.ino:94:9: note: suggested alternative: 'detachInterrupt' usbSetInterrupt(midiMsg, i); ^~~~~~~~~~~~~~~ detachInterrupt 2attiny85:95:9: error: 'sentPBR' was not declared in this scope sentPBR=0; ^~~~~~~ exit status 1 'uchar' was not declared in this scope ****************************************************************** Kindly suggest to solve, at least about "'uchar' was not declared in this scope". Thanks & Regards Email : smsammy0@gmail.com ------------- |
[top] | |
mit | Posted: 26 Dec 2019, 12:02 AM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Hi, take a look at the V-USB example projects and also the source code to some of my other attiny85 usb-midi projects, the ribbon controller only has part of the source on the project page. You might also want to look at an example USB-MIDI project using arduino, because there may be other things you need to do to get it to work with it. uchar is a V-USB macro that is just unsigned char. You can probably fix it by typing at the start of your program: #define uchar unsigned char Looks like the rest of the errors cascade from there. ------------- |
[top] | |
DAVID | Posted: 26 Dec 2019, 06:50 AM |
I love mcus Member Posts: 237 Joined: 10-September 17 |
Hi, I´m an expert when it comes in to using the Arduino IDE. What Mitxela did was just to put the main file of a V-USB example in his project page, so you will obviously have to provide the V-USB library. So to make it painless for you I made an Arduino library for you. https://github.com/theawsomeavr/Mitxelas_Ribbon_Controller Only thing that you have to do is to include this in your arduino library folder and open the example called "Mitxelas_Ribbon_Controller.ino" and Done!!!!! ------------- |
[top] | |
DAVID | Posted: 26 Dec 2019, 06:51 AM |
I love mcus Member Posts: 237 Joined: 10-September 17 |
I haven´t tested it yet so tell me if it works ------------- |
[top] | |
jimh54 | Posted: 18 Mar 2021, 03:25 PM |
Member Posts: 1 Joined: 18-March 21 |
Hello, 1st time here. I purchased the Ximimark 2Pcs Digispark Kickstarter Mini ATTINY85 USB Development Board Module for Arduino IDE 1.0 From Amazon for this project. I noticed the Schematic for it differs from yours a little bit. For instance, you use PB3 and PB4 for the resistive/button inputs and PB0, PB2 for the usb out/in. The Dev Board is just the opposite It uses PB3, PB4 for the usb out/in and PB0, PB2 for the resitstive/button inputs. I am not much of a coder but I need to know what to change in the code to make the corrections for the Dev Board. Thanks Last edit by jimh54 at 18 Mar 2021, 03:27 PM ------------- |
[top] | |
mit | Posted: 18 Mar 2021, 08:22 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
I'm a little rusty on it but I have a feeling you might struggle to get this project to work on that board. From what I remember, the V-USB library needs the INT0 pin to work. This is not needed for the micronucleus USB bootloader (which I think is what the digispark will be using) because that was significantly rewritten to avoid it. It's been long enough that maybe V-USB has been updated to support different pins, I don't know. If you can find some other example projects for the digispark that use USB that would help. It's probably easiest to start with one of their example projects and copy and paste the relevant code into it. ------------- |
[top] | |
DAVID | Posted: 31 Mar 2021, 12:49 AM |
I love mcus Member Posts: 237 Joined: 10-September 17 |
QUOTE (mit)
From what I remember, the V-USB library needs the INT0 pin to work. The original implementation of V-USB did use INT0 for the USB+ signal, however, all AVRs have the a neat interface called Pin Change Interrupts, they are similar to interrupt pins (a bit slower since you can not set the interrupt to trigger at a falling or rising edge and so it needs to be implemented by software) but they come on all pins so you could use almost any pair of pins for V-USB, just remember to edit the interrupt section of the usbconfig.h file according to which pins you decide to use. Alternatively since jimh54 is already using the Arduino IDE he could just modify the code and just use DigiMIDI library provided by Digistump for the Digispark. Last edit by DAVID at 31 Mar 2021, 01:05 AM ------------- |
[top] | |
Sign in to post a reply.