Comments (5)
Here's a simple version:
void beep (int freq, int duration) {
I2S.setAllPins(7, 5, 6, 6, 6); // sckPin, fsPin, sdPin, outSdPin, inSdPin
const int samplerate = 8000;
int halfwave = samplerate / freq, amplitude = 500;
unsigned long start = millis();
if (!I2S.begin(I2S_PHILIPS_MODE, samplerate, 16)) return; // Error
while (millis() < start + duration) {
if (count % halfwave == 0) amplitude = -1 * amplitude;
I2S.write(amplitude); I2S.write(amplitude);
}
I2S.end();
}
The frequency is in Hz and the duration in milliseconds.
from t-deck.
Which header files are needed, and how is I2S object constructed? (specifically for ESP32/T-Deck target)
from t-deck.
You need:
#include <I2S.h>
I also found I needed this:
#include "soc/periph_defs.h" // Not sure why necessary
It's based on the SimpleTone example which is in the ESP32 core at:
/Users/david/Library/Arduino15/packages/esp32/hardware/esp32/2.0.12/libraries/I2S/examples/SimpleTone
from t-deck.
Ah, thank you. I hear a beep now! :-)
from t-deck.
Is there a reason why "Play MP3" doesn't work in the UnitTest code?
from t-deck.
Related Issues (20)
- T-Deck 433 Mhz Bricked HOT 2
- PCB 3D export HOT 1
- Can't compile unit test HOT 3
- T-Deck will not connect when flashing HOT 1
- Antenna connector ripped. HOT 1
- Marauder port for t-deck HOT 1
- Measure battery left precent HOT 1
- New T-Deck cannot enter DFU nor gets detected by any computer as USB HOT 2
- track ball wont input up or down HOT 1
- SD card is not working HOT 2
- Hall effect sensor HOT 1
- Can the running firmware communicate to the keyboard controller? HOT 1
- Cant find the documentation for this board that includes any available GPIO pins HOT 5
- t-deck wont power on with fully charged battery
- Can't Compile Unitest in TDeck from Factory - all the steps in the guide completed - Error Compilation error: 'bool enableInterrupt' redeclared as different kind of entity HOT 4
- UnitTest example code shows nothing but a black screen on the t-deck HOT 5
- Looking to port a game
- Access IIC Pins HOT 2
- UnitTest.ino fails to compile. Missing kinetis.h
- Grove Set Question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from t-deck.