I have a raspberry pi pico and a DS3231 real time clock hooked up to it. I'm able to receive the current time in BCD and format it in a string by Hours:Minutes:seconds "00:00:00" using the DS3231 sample code that has been provided from the waveshare wiki waveshare wiki
I've tried using a datetime module but I get the error "no module named datetime" so I'm unsure if it's included within micropython.
this was my attempt
def elapsed_time(self, start, end):
start_time = datetime.strptime(start,"%H:%M:%S")
end_time = datetime.strptime(end,"%H:%M:%S")
return end_time - start_time
You can find datetime in the micropython-lib repository, a collection of curated (by the MicroPython core team) libraries useful when developing MicroPython applications.
For now, the easiest way to use datetime is to copy datetime.py to your device and ensure it can be found in your sys.path.
Related
I have this very simple 4 lines of code to retrieve a duration value in google sheet from Google Apps Script. The sheet is blank and has this only value for this test.
function myFunction() {
var my_ss = SpreadsheetApp.getActiveSpreadsheet();
var my_sh = my_ss.getSheetByName("test");
var my_value = my_sh.getRange("A1").getValue();
console.log(my_value);
}
When I run this in the new runtime V8, I got the good duration of 5 minutes (with bad GMT but I don't use this). But with the current bug on V8 where we can't use the console to develop arrays and object, I downgraded the script to Apps script Legacy, and when I execute the exact same code (I mean I don't do anything but downgrading the environment with the Run menu), then I got the good GMT but the wrong duration! I got 55 minutes and 39 seconds instead of 5 minutes!
I checked the time zone in apps script V8, apps script legacy and google sheet, it's the same every where, "GMT+01:00 Paris".
Even stranger: this test is actualy performed from a copy of an original file created on august 2019. In the original file I got the opposite behavior. I got the good value with apps script legacy, but with runtime V8 I got a different value (I got 23:14:21 instead of 00:05:00).
Does anyone else encounter this behaviors? Do you know how to run apps script legacy on new files without these problems? Thanks.
As a workaround you can use getDisplayValue() instead :
var my_value = my_sh.getRange("A1").getDisplayValue();
and then, based on this value, you can construct a date object of your preference.
So, I noticed that we had this issue only in the case we upgrade to V8 on a file that has was created before V8 was published (and vice versa). So to avoid this, if I have an old file where I want to upgrade apps scripts to V8, I copy the file first, and in the new file (so a recent one when V8 already exists), then I don't encounter the problem...
I'am trying to read the new sensor tags Dogbone, (with Magnus S3 IC) but I don't have luck.
I'am using Zebra RFD8500 and programming with the Zebra SDK for Android.
I want to read the RSSI or the temperature values, but it seems the problem is with the Select command.
In either case, it is a two step procedure : 1) select command to match a specific tag pattern in a specific pointer address at the MEMORY_USER_BANK. Then the IC detect that have to store
the solicited value in a specific address at the MEMORY_RESERVED_BANK and 2) read the value, from the specific address at the MEMORY_RESERVED_BANK.
For the Select command (C1G2) I tried with Access-filters and Pre-Filters, but although the tag is matched, the IC doesn't store a value in the RESERVED Bank.
Somebody knows if Zebra APIs support the reading of this newers tags ? Or suggest me any other test?
Thanks a lot for your help
Regards.
It's possible to read the RSSI value with EPC Gen2 tags, so if the tag you're referring to supports this standard it should work.
Try downloading the Zebra RFID sample app > Perform inventory > If the tag is found it should display the RSSI. The sample app code can be found here
As for the temperature values try reading the USER memory in the sample app as well to see if you can get it.
I suggest using the SLS smartSLED; it has built-in functionality for the Magnus (Axzon) chip family (both S2 and S3).
I have a 3-axis system, which resembles the CNC-axis, and a PowerPanel from B&R. Now I plan to execute the g-code, which I read from a file, which is fe located in the Downloads folder. This will be done with fbs from B&R Automation Studio.
I got confused with the help, since it says in drive engineering/mapp Motion/technologie/function block/mpcnc3axis/description the part of moveProgram, where it redirects you to MC_BR_MoveProgram \ description. There stands that you can start the program with [Program name prefix] [File device name:] [Path] Program name syntax. Now I am not sure how to include this with my MpCnc3Axis code or if I can use the syntax also in MpCnc3AxisParType ProgramName part to start the program from fe Downloads Folder, since it didn't work with McPrgAdvParType InitProgramName.
Any links to related material would be appreciated.
I would also accept a solution with C, if it is easier.
Depending on if you are willing to buy software licences from B&R, running a CNC system is more or less easy.
The state of the art implementation is with mappMotion. It requires software licenses and gives you ready to go FUBs to execute nc files, jogging, direct movements, etc. This works the same way for different robot types and CNC kinematics. I recently uploaded a small implementation of a robot on GitLab: https://gitlab.com/kirni/bur_robotic_sample
The alternative is the old ARNC0 approach. No more new features are implemented, but it is free - as long as you do not need any functions that require a Dual Use agreement (i.e. 5 Axis CNC, etc.). The implementation is rather complex and is definitely to extensive to be answered completely at stackoverflow.
However Automation Studio ships with a sample for a two axis CNC. In the logical view you can add a new object Library Samples which opens a dialog where you can select Samples/Motion/CNC system (2 axis)/LibARNC0_Basic_ST.zip. This would be the best starting point, which is also documented in the help in MotionControl/ACP10 ARNC0/Examples/CNC or guid: 4620bb1c-8694-4f27-87d0-805686d7c0c8 as of AS 4.4.4.64.
I hope this helps!
I am writing a c# application that uses OSIsoft AFSDK dll (2016 version). My application should define PI server collective and send data to this collective.
But what I'm trying to figure out is:
using C# code, how to define a PI data archive servers as a collective? and how to configure one of them to be the primary server?
I've been searching for code examples and couldn't find any code.
Can anyone post an example or a reference to such an example?
you can add a new Collective to the Known Servers Table using the next code snippet:
using OSIsoft.AF.PI;
PIServers myPIServers = new PIServers();
PIServer newPIServer = myPIServers.Add("NewPIServer");
Then you can access to PI Collective information using:
PICollective collective = newPIServer.Collective
You can consult the Live Library:
https://techsupport.osisoft.com/Documentation/PI-AF-SDK/Html/T_OSIsoft_AF_PI_PIServers.htm
And also there's a very good forum for anything regarding OSIsoft PI: https://pisquare.osisoft.com/
Hope it helps!
I am working on Solaris 12 and I am trying to get device path like this:
/pci#0,0/pci108e,4856#1f,2:devctl
I could obtain the this path through CLI using prtconf -v. How could I obtain the path through api using C function? I tried serveral functions in libdevinfo, such as di_devfs_path, but it didn't give the same path as the prtconf gives me. Should I use functions like di_node_name, di_instance, di_binding_name to get pieces of information and construct the path by my own. Or there is a function to get the whole device path?
Thanks.
Firstly, unless you're working for Oracle in the Systems division, you're not working on Solaris 12. (If you are working for Oracle, why haven't you asked
Oracle internal mailing lists for help?)
Secondly, the :devctl node is a minor for the device, so you'll need to walk the minor nodes using di_walk_minor() and check di_minor_name() to see if it matches your criteria.
Finally, yes, this should work on Solaris 10 and later.