Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Introducing the Pi-cromite: first steps
Page 15 of 16 | |||||
Author | Message | ||||
hitsware Guru Joined: 23/11/2012 Location: United StatesPosts: 535 |
> "Save" in the editor moves the program from the edit buffer > and "saves" it in normal RAM ready for execution. > Unlike the Micromite, the Raspberry Pi always has a SD card available so, > to save for next time, > it is just a matter of saving to disk once you have exited the editor. ???????????????????????? save ?????? from ???? to ?????? |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
Ahhhhh..... So it was not the reason of not understanding it, because English is not my native language. I also did not understand it😄😄 Please explain it again Peter... Thank you |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
F1 to exit the editor or ^O ^X if you are using nano This puts you back at the mmbasic prompt with your program loaded. SAVE "myprogam.bas" will save the currently loaded program as myprogram.bas in the current directory on the SD card, overwriting any program of the same name. LOAD "myprogram.bas" will load the file myprogram.bas into memory, overwriting the current program in memory. FILES will list the files in the current directory VK7JH MMedit  MMBasic Help |
||||
RonnS Senior Member Joined: 16/07/2015 Location: GermanyPosts: 120 |
System command Someone knows how I can make a text output from them ??? to display it system "vcgencmd measure_temp" or system 'vcgencmd measure_volts or system 'vcgencmd measure_clock arm thanks for help Ron |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
Na klar, write (pipe) output into a file > or >> and then open this file with mmbasic file open ..... ready |
||||
RonnS Senior Member Joined: 16/07/2015 Location: GermanyPosts: 120 |
thanks Atmega, meanwhile I have also found Peters guidance |
||||
cdeagle Senior Member Joined: 22/06/2014 Location: United StatesPosts: 261 |
A useful open source (Linux) desktop publishing program for the Raspberry Pi is Scribus. It's the usual sudo apt-get install scribus to retrieve and install it. I'm currently using it to view and print eps graphics images. |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
@matherp meanwhile I have also found Peters guidance However, more generally you can use standard LINUX notation to capture any SYSTEM output as follows: System "ls -al >> myfile" Open "myfile" For input As #1 Do Line Input #1,a$ Print a$ Loop While Not Eof(#1) Close #1 Kill "myfile" Of course rather than just read the file and print it line by line you can do any processing that you wish Is there a way to 'intercept' the SYSTEM response directly into MMBASIC rather than via a file? The reason for asking is that I need to do a continual SYSTEM command (in a loop meaning about two a second) and I am not wanting to wear out my uSD card with the system that needs to be left on 24/7 Also leads to the question: Are there any MMBASIC commands that you can think of that could 'wear out' the uSD card in general use? Thanks. WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
WW, the Linux system is permanently writing logfiles in the background /var/Log/messages and many other places. SD cards have wear leveling algorithms which try to rotate the writes to different locations/ cells. You should use SD cards with hi capacity 16/32 GB to maximize this effect. I ave Linux Running on PI over 3 years, with a 4 GB Card and it didn't fail. DS |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Hi Dietmar, Thanks for your response. I guess my concern is that in my solution I would effectively be writing (and then killing) upwards of 7,000 'myflies' every hour ( ) based on the sample code above from Peter. In my simple world of thinking, I was feeling that this quantity would have an impact on the uSD in a very short time span - even with load balancing. I may be totally wrong, but just doing the simple maths makes me think it would be much better to be able to grab the SYSTEM response directly into MMBASIC. Ultimately I am 'updating' my original MMBASIC Internet Streaming Radio (which was based on a 28pin BackPack) and bringing it onto the Pi-croMite. I use the popular Music Daemon program (MPD) along with the Music Player Client (MPC) and want to write the song information to the GUI with the 'MPC STATUS' command. It is this command (sent using MMBASIC's SYSTEM command) that I need to intercept on a 'regular' basis. Two to three times a second gives a nice 'responsive' display. Open to other ideas on 'grabbing' the response from SYSTEM "MPC STATUS >> myflie" WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
bigfix Senior Member Joined: 20/02/2014 Location: AustriaPosts: 124 |
Phil, how about a tiny ramdisk for the hot files ? I am not familar with Raspian at all, but you easily find recipes how to do: Ramdisk It is of course volatile - but to handover data it should work You can also use a real SSD on USB with the RPi3 But it is still challenged a little by excessive writes (the SSD may last only 20+ years...) |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
I've thought of a way of directing system output to a LONGSTRING which will allow you to capture and analyse the output in memory. I'll try and post a new release later today |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
THANKS PETER (you can ignore my last part of the email I just sent!!) WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
You know, in linux nothing is impossbly, nearly. Why overlaod Peter and the code with funktions that can easily be done with linux??? A simple mount tmpfs <mountpoint> -t tmpfs -o size=1M will do the job for you |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
A simple mount tmpfs <mountpoint> -t tmpfs -o size=1M will do the job for you Can those two highlighted words really be used in the same sentence? Ideally want to remain in the MMBASIC environment where command syntax means something obvious Without Googling, I have no possible sensible guess as to what: tmpfs, -t, or -o do or mean. The language is totally alien to me; but that may just be me! @matherp I am not convinced the IR stuff works (or at least with a 4"IPS attached). Have tried a 38KHz, and 40KHz IR receiver on Pin 16 and use the example in the standard MM manual. In my main Do Loop I am just toggling an LED attached to another pin (and updating the Time on the IPS). Very occasionally I get a response in my IR_Int where I just try and display the DevCode & KeyCode on the IPS. All hardware works ok - tested on a 28pin MM. Using 5.3.a32 BUT this was implemented in a14. Can anyone out there run a IR test on the Pi-croMite please and report back Please let me now which version of MMBASIC too! WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
Can those two highlighted words really be used in the same sentence? Of course it can, but you must be willing to use your brain, or goggle, better both, where/what is your problem? RAMDISK is selfexplaining also for windows/mouse gurus |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
I believe that if Peter is able to implement the FIELD scenario that he refers to above then the solution will simply be something like: SYSTEM "MPC STATUS" (and all contained within MMBASIC)Artist$=FIELD.... Track$=FIELD.... The above has to be easier than creating a RAMDISK using tmpfs <mountpoint> -t tmpfs -o size=1M and then loading the SYSTEM "MPC STATUS" response into this RAMDISK, then extracting line by line. I always look at MMBASIC 'coding' from a beginners point of view, so the easier we can make it, the better the 'end experience' is for the user. However, that said, you have now highlighted a potentially useful linux feature that I was totally unaware about - it could be very useful for another project I am working on For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
No limits to the limits of our imagination 🤓🤓 |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
Please find attached version 5.4.a06 2017-07-06_112516_mmbasic.zip Please delete the OPTIONS file before use: "rm .options" Changes are: Bug fixes/changes as per Micromite release 5.4.05 OPTION PINS pinmask specify pins to be excluded from mmbasic e.g. OPTION PINS &B10100 ‘exclude pins 3 and 5 from use by mmbasic OPTION LIST will report the pinmask if none-zero SETPIN reservedpin,DOUT will report a reserved on boot error Once the pins are reserved exit mmbasic and set up the pins as you wish external to mmbasic or do it using system command from within mmbasic I’ve checked I can waggle pins from LINUX with MMBasic running and that restarting MMBasic does not affect them SYSTEM "LINUX command" {,longstringarray()} There is now an additional optional parameter to the system command. This is specified as an integer array which is used to hold a LONGSTRING . The output from the system command will be stored in the array and can be interrogated using the set of LONGSTRING commands and functions. If the output would be longer than the array can hold it will be truncated. The use of this is shown by this simple example [code] DIM INTEGER a(1000) SYSTEM "ls -al",a() FOR i=1 to LLEN(a()) print LGETSTR$(a(),i,1); NEXT i [/code] For reference the complete set of LONGSTRING commands and functions are: LONGSTRING APPEND longstringarray%(), string_to_append$ LONGSTRING TRIM longstringarray%(), number_of_chars_to_remove_from_start LONGSTRING REPLACE longstringarray%(), new_string$, start_position LONGSTRING LOAD longstringarray%(), string_to_load$ LONGSTRING LEFT destination_longstringarray%(), source_longstringarray%(), number_of_chars LONGSTRING RIGHT destination_longstringarray%(), source_longstringarray%(), number_of_chars LONGSTRING MID destination_longstringarray%(), source_longstringarray%(), start_position, number_of_chars LONGSTRING CLEAR longstringarray%() LONGSTRING UCASE longstringarray%() LONGSTRING LCASE longstringarray%() LONGSTRING COPY destination_longstringarray%(), source_longstringarray%() LONGSTRING CONCAT destination_longstringarray%(), source_longstringarray%() substring$ = LGETSTR$(longstringarray%(), start_position, number_of_chars) string_length% = LLEN(longstringarray%()) test_string_position = LINSTR(longstringarray%(), test_string$ [,start_position]) string_comparision = LCOMPARE(first_longstringarray%(), second_longstringarray%()) |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
Please find attached version 5.4.a07 2017-07-06_153723_mmbasic.zip Please delete the OPTIONS file before use: "rm .options" This has one more OPTION command OPTION CLOCK clocktype Valid values are PCM (default) and PWM. This command is used to specify which of the two main Pi clocks are used for mmbasic. The default allows hardware PWM to be used on pin 12 but will cause external commands using the PCM clock, such as output on the i2s port, to fail. To understand this together with the previous release consider i2s set up as the main audio output of the Pi. This can be enabled as the default for audio using sudo curl -sS https://get.pimoroni.com/phatdac | bash The pinout for i2s is: Bit-clock : pin 12 LR-clock : pin 35 i2s-data-in : pin 38 i2s data-out : pin 40 These pins can be "protected" from mmbasic using the command OPTION PINS &HA400000800 The PWM clock must also be used by mmbasic to leave the PCM clock free OPTION CLOCK PWM Then an audio file can be played over i2s either external to mmbasic (and unaffected by it), or from mmbasic using any appropriate Linux command SYSTEM "aplay wavfile" To play mp3 or flac files over i2s I found mpv worked, omxplayer does not work [code]sudo apt-get install mpv[/code] |
||||
Page 15 of 16 |
Print this page |