vscode+ESP-IDF How to light up the oled screen - esp32

I am new to esp32 programming.I wanted to try to light up the screen,but i don't know how to download the relevant library on vscode or IDF.Thanks for your help.
enter image description here
enter image description here
I think the reason is I don't downdoad the relevant library.

Sidenote: The solution is the first result on a Google search of your error. It might be prudent to try doing a search before opening a question.
Based on your question, I've assumed that you're using PlatformIO with ESP-IDF, in VSCode.
From the compilation logs, it appears that the Wire library is missing. To resolve that, you can simply add lib_deps = Wire under the [env] section of your platformio.ini file. So, the [env] section of the platformio.ini file should look like this:
[env]
platform = https://github.com/tasmota/platform-espressif32/#Tasmota/204
board = nodemcu-32s
framework = arduino, espidf
upload_port = /dev/cu.usbserial-0001
monitor_port = /dev/cu.usbserial-0001
monitor_speed = 115200
lib_deps = Wire ; <--- This line

Related

a question about omnet++ wireless node's source code

I want to see the source code for sending data packets wirelessly,but I try a lot ,such as refer to tutorials ,but I still can not find it.Who can help me that? very thanks!!
First of all I suggest doing the basic tutorial for OMNeT++ available in TicToc Tutorial.
The NED definitions as well as C++ source files of link layer are in src/inet/linklayer, for example src/inet/linklayer/ieee80211. Moreover, take a look at INET User's Guide.
I am also new to the OMNET++ and inet. I have exactly same problem as yours. When I search the "wlan" node, I found it was used as submodules in /inet/node/base/LinkLayerNodeBase.ned. The type of "wlan" in default is , which source code is under "/inet/linklayer/ieee80211/ieee80211Interface.ned". I suppose we are using same tutorial, then the omnetpp.ini has claimed that the "wlan" type is AckingWirelessInterface in this sentence
*.host*.wlan[0].typename = "AckingWirelessInterface". And this AckingWirelessInterface is actually another compound module "/inet/linklayer/acking/AckingWirelessInterface" that implement "IWirelessInterface". To find how it handle the packages, you should go to his submodules:. More specifically, you can check "inet/linklayer/acking/AckingMac.cc" and "inet/physicallayer/unitdisk/UnitDiskRadio.cc" to find module and module.

How to render a specific audio unit in a AUGraph

I setup an AUGraph wich contains several audio unit.
I know that when I call AUGraphStart() the graph starts the rendering of all the audio unit. But I would like to be able to start the rendering of one specific AUFilePlayer.
Is it possible?
UPDATE
I saw in comment that my question lacked of details.
I have the current setup for my AUGraph:
AUFilePlayer -> AUMixer -> AUOutput
I setup the AUFilePlayer with a specific AudioFileID.
When I start the graph I would like just to "start" the graph without having any sound.
And later I would like to do something like: AUFilePlayer.Play() to start making sounds.
I don't know if it's possible...
UPDATE: workaround found
I think I found a workaround for this. See my answer for my details.
I found the following workaround:
When I setup my AUFilePlayer I set the value mFramesToPlay of the ScheduledAudioFileRegion struct to:
ScheduledAudioFileRegion audio_file_region;
/*... init values...*/
audio_file_region_.mFramesToPlay = 0;
instead of
audio_file_region_.mFramesToPlay = number_of_frames_for_the_audio_file;
That way when I start the graph, the AUFilePlayer doesn't play any sound.
Then I have a methods Play() where I set the right frames to play for the mFramesToPlay field.
I don't know if it's a good way to do this but it does its job.

How to convert PDF to Image without generating a file

Based on the Code How-To-Convert-PDF-to-Image-Using-Ghostscript-API
I trying to figure out how to get a image foreach page without creating the files
To get an image foreach Page i setted OutputToMultipleFile = true.
Then i went step for step through his code but i wasn't able to find the part where the files get created.
So i want to know what i need to change in this code?
or anything else which helps to achieve this
EDIT
here my current parameters:
args[0] =
args[1] =-dNOPAUSE
args[2] =-dBATCH
args[3] =-dSAFER
args[4] =-sDEVICE=pnggray
args[5] =-r130
args[6] =-sOutputFile="C:\Scannen1.PDF%d.png"
args[7] ="C:\Scannen1.PDF"
You need to use a device which doesn't write to file, all the image format devices write their output to file. You could use the display device which will return you a bitmap in memory as a template and write your own device, or you can modify one of the existing devices.
Modifying an existing device is a task for a developer and while not excessively difficult is not trivial either.
In any event, you aren't going to get what you want by fiddling with command line switches. Like Sinatr I'm puzzled by what you can usefully do with Ghostscript which doesn't involve writing to file.
Oh, one other possibility is to load the nulldevice, which is done in PostScript and is simply a bit bucket.

Windows 7, wxpython, unknown font weight

I'm kind of new at this:
My app works great in Linux, where I developed it. I'm trying to port it to win7 before making it an exe (the school psych wants to use it on her computer). One of the functions of the app is to change the font size in response to an event (in this case, the user presses a button).
Here's the code:
if countfinal == 1:
on_start = time.time()
ot.append(on_start)
self.welcome.SetLabel("Timing On Task Event")
self.label_directions.SetLabel("Timing On Task Event")
self.SetBackgroundColour(wx.GREEN)
on.append(1)
font = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.DEFAULT, wx.FONTENCODING_SYSTEM)
self.label_directions.SetFont(font)
self.save_quit.Enable(False)
Windows 7 throws up this error:
Traceback (most recent call last):
File "time.py", line 131, in time_event
font = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.DEFAULT, wx.FONTENCODING_SYSTEM)
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 2081, in __init__
_gdi_.Font_swiginit(self,_gdi_.new_Font(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..\..\src \msw\font.cpp(560) in wxNativeFontInfo::Se
tWeight(): unknown font weight
I've been reading that it has something to do with Windows not using UTF-8. That's nice, but it doesn't help me.
How do I tell wx to use the font encoding Windows 7 recognizes? Could someone be so kind as to provide me with a code example that does this? The documentation is a little too cryptic for me; I'm still at that struggling neophyte stage with this.
I wrote an article about fonts on my blog. I just tried the code and added an 18 pt font to the "sizes" list and it worked fine. Maybe you could try it on your computer and see if it works there too? If it does, then you'll want to see where your code differs from mine.
Okay, I figured out where my mistake was on this one. I was doing two things wrong:
I was misreading the error code. The error code referred to "weight" and not "size." The whole utf-8 thing really was a rabbit hole to nowhere.
I was putting things in the wrong order. Mike Driscoll's tutorial makes it clear with this example:
font = wx.Font(size, families[family], styles[style],
weights[weight])
that wx is picky about the order of attributes. It goes size, family, style, weight. I had them out of order. I think I was also using the wrong wx attributes. It seems that some tutorials will include wx.DEFAULT rather than wx.FONTFAMILY_DEFAULT. That's wickedly confusing to a new programmer. Is it really that hard to just write out the first part of the tag? Especially in a tutorial?
Here's the code that works:
if countfinal == 1
size = 18
font = wx.Font(size, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.label_directions.SetFont(font)
Special thanks to Mike Driscoll for posting an answer and for writing that tutorial!
Cheers!

How to programmatically rename movie and TV show files in an iTunes library, for XBMC compatibility?

I have a collection of movies and TV shows in iTunes, and I'd like to rename them to an XBMC compatible naming convention without breaking the links in iTunes.
All the necessary metadata (season number, show name, episode number, etc) seems to be in an XML file that iTunes manages, and the episode name is the current file name. So programmatically renaming the files seems fairly straightforward but how do I keep the iTunes library straight at the same time? Is it enough to rewrite the XML file to point to the new file names?
I'd rather not get into applescript if I can avoid it (life is too short), however if it is easier to do it that way I may look at it. Otherwise I'd ideally like to do this in ruby.
On Windows Apple provides the iTunes COM for Windows SDK that works quite well. It is created using a COM interface so it works with almost every language available for Windows. It provides methods for renaming Tracks and Playlists. I have used this to do all kinds of things with my Library.
I do not know what's available on a MAC, but I believe AppleScript is the best native way to access what's available. There is a project called "EyeTunes" that provides a Cocoa framework. There is a site devoted to Applescript ("Doug's AppleScripts for iTunes"). Here is a site showing how to access iTunes from perl.
If you want to rename both the file and the iTunes name then it's probably better to change the track name, remove the file from the library, rename the file, and then re-add the track. You would need to preserve information like last played, playcount, etc.
Not sure if you're on a Windows box but honestly if you can write even a little Javascript the iTunes COM API is very easy to use.
Below is a sample of what it will look like. (this is NOT tested, so only use it as a reference.)
var ITTrackKindFile = 1;
var iTunesApp = WScript.CreateObject("iTunes.Application");
var deletedTracks = 0;
var mainLibrary = iTunesApp.LibraryPlaylist;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;
var RenameTarget;
while (i > 0)
{
var currTrack = tracks.Item(numTracks);
// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{
RenameTarget = "Stuff from other properties"
currTrack.Name = RenameTarget; //
}
numTracks++;
}
Good Luck.
Late but I needed exactly the same for Plex on OS X.
My solution was to write a Python script that queries iTunes for its TV shows via the AppleScript bridge, gets the file path from each track's location attribute and then creates a symlink to the original file, using iTunes metadata to give the link a name suitable for Plex/XBMC etc.
The advantage is you can painlessly create multiple sets of links with different naming schemes, e.g. My Name Is Earl S01E10.m4v or My Name Is Earl 01x10 White Lie Christmas.m4v
The core of the script is (where track is the reference provided by the appscript bridge):
def trackInfo(track):
"""returns tuple (filename, filepath, show)
track is iTunes playlist track from appscript bridge,
filename is of format "Showname 01x02 Episode Name.avi" where
01 is the season number, 02 the episode number and the extension
will match that of filepath.
filepath is the UNIX path to the original file.
"""
try:
path = track.location().path
except CommandError:
return None, None, None
ext = os.path.splitext(path)[1]
name = "%s %02dx%02d %s%s" % (track.show(), track.season_number(),
track.episode_number(), track.name(), ext)
return name, path, track.show()
I use identify2 for mac to rename my shows - works great!
Check out EpNamer at http://www.epnamer.com/. It requires .NET but is exactly what you're looking for and XBMC is exactly what I use it for too.
You might also look into using Media Companion since you're most likely using the library functionality of XBMC, which you can read about here:
http://xbmc.org/forum/showthread.php?p=217769
It'll make .nfo and .tbn files for each movie and TV show that you've got which XBMC will scrape before going out to the internet for information.
Enjoy!
Another way to play with the iTunes xml file is to use the plist module.

Resources