Hot answers tagged

7

You are not initializing x and y. When a local variable isn't initialized, it will "inherit" the value contained in the register assigned to the variable by the compiler. The fact that your single loop example worked is pure luck - the assigned register happened to contain 0 at that point in execution. Change your nested loop like this: for (int x = 0; x &...


6

From looking at the source it appears that on 32u4 based boards Serial includes extra methods to access the settings from the USB host: see: https://github.com/arduino/ArduinoCore-avr/blob/b7c607663fecc232e598f2c0acf419ceb0b7078c/cores/arduino/USBAPI.h#L129 From USBAPI.h: // These return the settings specified by the USB host for the // serial port. ...


5

According to the documentation, SysEx messages are sent like any other messages: array[0] = 0xf0; array[1] = 0x7f; array[2] = 0x7f; array[3] = 0x02; array[4] = 0x7f; array[5] = 0x01; array[6] = 0xf7; usbMIDI.sendSysEx(7, array);


4

After correcting the syntax error (missing semicolon) I tried your code on my Teensy 3.0. The results look OK to me: Start... 1250 2250 Finished 1000 milliseconds elapsed Start... 2250 3250 Finished 1000 milliseconds elapsed Start... 3250 4250 Finished 1000 milliseconds elapsed Start... 4250 5250 Finished 1000 milliseconds elapsed Start... 5250 6250 ...


4

You can't just "print" a key like that. You use print for sending text. When you use println it sends an enter key along with your text, so you can do : Keyboard.println("ls -al"); and it will send the text ls -al and press enter for you. If you want to do it in the 'raw' way you will need to press and then release the key: Keyboard.press(KEY_ENTER); ...


4

I realize this is an ancient question, but just in case someone else has one of these things, I'll share what I know. I have one of these Sharp LCDs that I typically use as a monitor for a Commodore 64. I believe mine was originally from a rear seat DVD player in a Ford Explorer. Looking at the rear of the unit, with the two connectors on the bottom, the ...


4

All Teensies support digitalWriteFast out of the box. digitalWriteFast compiles to just setting the bit in the right port register. You can not do that faster by direct register manipulation. However, if for some reason you do want to manipulate the registers directly here the pin/gpio relation for the T4. (Generated by the sketch described here: https://...


4

By default the fastLed is limiting the refresh rate to 400 fps (i.e. 2.5ms). You can disable that with FastLED.setMaxRefreshRate(0);


4

There is no problem here. Only the compiler is a bit smarter than you anticipated. It sees, that you are not using arr anywhere, so it just optimizes it out. There are two ways to prevent that, if you really want to: I think you can use flags to tell the compiler, that this shouldn't be optimized out. I'm no expert in this, others might know more about this ...


3

Paul Stoffregen (Teensy creator) has released a command line version of the Teensy Loader which can be found on his website. However, this program appears to be Linux only, so unless your client has Linux, that may be a non-starter. The source code for the program is available, so you might be able to work out the logic and port it over to whatever platform ...


3

To better understand how you can do this it is good to understand first just what goes on when a button bounces. It is, literally, bouncing - just like a ball when you drop it. Due to the fact that it's either connected to ground or pulled up to +5V by the pullup resistor it's either going to be LOW or HIGH with very little time between when it's not in ...


3

Using the latest Teensyduino distribution as of this writing, 1.25, you have to uncomment the higher overclocking options in the boards.txt file, located here in my install- /hardware/teensy/avr/boards.txt The options look like this, just remove the # symbol- #uncomment these if you want to try faster overclocking #teensy31.menu.speed.168opt=168 MHz ...


3

Your best bet is to try to take the casing off until you find a company name so that you can get a lead on where to look for documentation. Because until you find out more about how that screen works, it's a black box to you and you don't know what to put in it. No one else will be able to help you until you provide more information to this extent because no ...


3

First of all, do you really need int values for the measurements or not? If not, and you have numbers between 0 and 255, switch the values to byte, your microcontroller will thank you. Then, there is a problem with the other answers, which is... The variables cannot be left uninitialized!!! You can use this code to get the info you need: (I also put the ...


3

The whole concept of Baud Rate with USB communication is completely meaningless. There is no such thing as "baud rate" over USB. What there is, and what you are confusing with "baud rate" is a configuration item which the host can send to the device which is a "I would like you to communicate with other devices at this speed" configuration item. This is ...


3

I'm afraid your test program doesn't work as you intended. I tested it with a T4.1 without RAM soldered on and it gives the same result as in your question. You didn't declare your array volatile. Thus, the compiler can (and probably will) simply optimize the reading back away. Even if you declare the variable volatile the processor reads back the value ...


3

Paul here. I'm the author of that memtest program, and also the creator of Teensy. While luni64 already answered very well about your test program, hopefully I can add some clarity about the official memtest program. Regarding "I thought that PSRAM could only be accessed via EXTMEM", indeed use of EXTMEM arrays or variables is the normal way. ...


3

The Sparkfun RS232 shifter is not a great device. It relies on whatever it's connected to (on the 9-pin port) providing the negative rail for the EIA-232 voltage levels. That's fine when you connect to something that has those voltages available, such as a computer, but many "devices" don't - they will themselves have a similar shifter inside and ...


2

Arrays in C/C++ are handled as a pointer. That means the value of the pointer is the location in memory of the first element in the array. The next element is at that starting address, plus the size of each element. So for an array of 1-byte characters, each item in the array is at the very next address. For 32-bit members, it's at +4, and so forth. You'...


2

Here are a few examples how to pass vectors and variable number of arguments to a function in C/C++: void foo(int* vector, size_t nmemb); The function foo takes a vector of integers and the number of members, nmemb. const size_t VECTOR_MAX = 5; int vector[VECTOR_MAX] = { 0, 1, 3, 5, 7 }; foo(vector, VECTOR_MAX); The next variant is generalization. A ...


2

If the list is a static list you could conceivably pass a pointer to it in the constructor. Example: class myClass { const int num_; const int * values_; public: // constructor myClass (const int num, const int * values) : num_ (num), values_ (values) { } // other stuff here // demo void printThem (); }; // end of class myClass void ...


2

No. You should provide your own regulator or supply for the servos specified voltage. This might be an original design, or an off-the-shelf "battery eliminator" intended for an R/C vehicle of similar needs. Note that the teensy regulator's maximum input voltage is fairly low, and may be in the range of what more powerful servos expect, ie, you might be ...


2

Actually, Majenko's diagram assumes the interplay of the pullup resistor forces the line back to a HIGH position (as quickly as the internal transistors can overpower the drop from the switch). If the switch itself is mechanical with a pullup resistor (external or internal), then the only thing "bouncing" is the switch. If you use a digital switch, the ...


2

Shared memory only makes any sense in two combined situations: You have a kernel arbitrating processes, threads and memory allocation, with process isolation You have multiple threads or processes in your application You certainly don't have number 1 unless you can install an operating system on the Teensy 3.1 (some RTOS may provide a SHM analogue). As ...


2

In your loop(), you increment repeatedly loopnumber without ever resetting it. You should at the very least replace loopnumber++ ; with loopnumber = (loopnumber+1)%2560 ; Otherwise, when loopnumber becomes >= 2560, your save() function will begin writing outside the 'everything' array and overwriting whatever is written in the adjacent positions of ...


2

Without the ground of the teensy connected to the ground of the fan all you will be measuring is noise. Ground is required to complete the circuit between the teensy and the fan.


2

The Cortex M does not "have RAM at 0x2000000". The Cortex M is just a CPU. It is down to the chip manufacturer where they choose to place RAM in the memory map. In the case of the MKL26Z64VFT4 used on the Teensy LC: The on-chip SRAM is a single contiguous block split into two ranges: 1/4 is allocated to SRAM_L, and 3/4 is allocated to SRAM_U. Regardless ...


2

[Completely rewritten answer] That seems fun. But why 65 keys ? with 64 keys it is easier. You have to test the sensitivity of the hall switches with the magnets to know how far apart the keys must be. Perhaps they only work with strong magnets or perhaps a number of them are activated when the glove is near. With hall switches, there are 65 digital ...


2

As Juraj rightly points out, you have a typo, which should give you the following compile time error: In file included from sketch/Sensor.cpp:1:0: Sensor.h:17: error: 'pivate' does not name a type pivate: ^ Here is the correct code for Sensor.h #ifndef Sensor_h #define Sensor_h #include <EEPROM.h> #include "IMU/L3G.h" #define CUTOFF_FREQ 30 #...


Only top voted, non community-wiki answers of a minimum length are eligible