Use AssignFile, otherwise it thinks you're calling the Assign method of the form.Thank you @Wallaby, your fix works. I see the RX led flicker on the nano but the led on pin 13 does not stay on. It flickers though. When I test my code in the Arduino sketch using the serial monitor everything works as expected. Any ideas?
All that AssignFile does is calling system.Assign anyway, which makes it imho code rot.They could have better made the AssignFile an inline function then ;)
Use AssignFile, otherwise it thinks you're calling the Assign method of the form.Thank you @Wallaby, your fix works. I see the RX led flicker on the nano but the led on pin 13 does not stay on. It flickers though. When I test my code in the Arduino sketch using the serial monitor everything works as expected. Any ideas?
They could have better made the AssignFile an inline function then ;)
Yes. full code from objpas is this:All that AssignFile does is calling system.Assign anyway, which makes it imho code rot.They could have better made the AssignFile an inline function then ;)
I would have less trouble with it if it was a simple alias in system, not objpas.
That would also solve any ambiguities. it is also nitpicking from my side... :-X
Is the ability to use a dot i.e. System.something dependent on the mode of the compiler, or has there ever been a time when it was? I'm very much used to the module.entrypoint notation from Modula-2, but I don't know how long Pascal's supported it and there are no doubt some who conflate it with much newer namespace facilities.
p.s /nits/ please Thaddy. English for lice, i.e. bugs.
Assignfile is a fallacy. Use system.assign instead, so prefix assign with the unit. It does not matter too much in this case, but it is a non-solution that proves hard to get rid of. It is just there to prevent scoping issues, which are better solved by providing the scope - unit name - you mean explicitly. That is much cleaner.Thanks @Thaddy I will use system.assign ( I did not know until you mentioned it ) do you have any thoughts on why I am unable to get the nano led to light up?
All that AssignFile does is calling system.Assign anyway, which makes it imho code rot.
It is also not available in all modes, because it is defined in the objpas unit, as opposed to system.assign which is available in all modes.
you've not given the community a testable project for this oneEven after compressing my zip is over the 500kb limit of the forum. Here is the source for anyone interested. (https://drive.google.com/file/d/1YzT0yJ_g_MSvHWf3XqfbfHpuKEWmuTfw/view?usp=sharing)
If you'd posted a proper project, it would be apparent that in the file causing the error you had imported other units which (we can reliably speculate) bring in implementations of Assign() other than System.Assign(), and that these are for some reason "closer" to the point of failure in a way that prevents polymorphism from telling the compiler which one to use.Single unit no other imports :-)
you've not given the community a testable project for this oneEven after compressing my zip is over the 500kb limit of the forum. Here is the source for anyone interested. (https://drive.google.com/file/d/1YzT0yJ_g_MSvHWf3XqfbfHpuKEWmuTfw/view?usp=sharing)If you'd posted a proper project, it would be apparent that in the file causing the error you had imported other units which (we can reliably speculate) bring in implementations of Assign() other than System.Assign(), and that these are for some reason "closer" to the point of failure in a way that prevents polymorphism from telling the compiler which one to use.Single unit no other imports :-)
OK, but at that point I have to ask: why are you trying to use ordinary file operations with a serial port?Everything is a *file* in linux, is why :-)
Can you please move the discussion about LED's to another thread.If you look at my initial post again you will see it says:
This thread is supposed to be about Assign().Bart
OK, but at that point I have to ask: why are you trying to use ordinary file operations with a serial port?Everything is a *file* in linux, is why :-)
Everything IS NOT a file in unix.I said linux not unix :-) and your veering off-topic ( ...again)
What's more, something like /dev/ttyUSB0 might be a file in unix, but that doesn't mean you can manipulate it like a file from Pascal: you can't. And that's (a) why things like serial.pp, SynAser and so on exist, and (b) why serial libraries/components (and network protocol ditto etc.) aren't applicable to ordinary files.You may want to reconsider that after watching this (https://www.google.com/search?sca_esv=445c9ec50e6b4223&sca_upv=1&sxsrf=ADLYWIIYWGUSwNLjQ4IBXxRFqKR01qcp4A:1727093150707&q=pascal+arduino&tbm=vid&source=lnms&fbs=AEQNm0CRraR4AFMOJtZDUPiZk_hDDcI2gsUCGe9dZxqjUB5Fjbg9g5Dvlwra67P-0Tq9xG3V6wtiiRWn3AMd3MwHGOtFdRgA2KD1bARv7g8btBn6Jlpu6imrEpstW2EY-NoR5DuL98FVdmK9OH0IsUWSs3kBQGNjkiv0KxcLJR6RW4EGB5adX2SRbewUlFeAZEE3zLI2szaVLCj1-4TxmjOoB-MtUkPttA&sa=X&ved=2ahUKEwjmvPetg9mIAxWXFzQIHS7rHqIQ0pQJegQIEBAB&biw=1680&bih=863&dpr=1#fpstate=ive&vld=cid:a6037fa6,vid:UfQIkNl7gKM,st:0)
You may want to reconsider that
Denial can be harmful because it prevents individuals from addressing reality and dealing with problems in a constructive manner. By refusing to acknowledge harmful behaviors or negative situations, denial perpetuates cycles of harm. This could involve repeating destructive habits, remaining in toxic environments, or enabling others' unhealthy behavior.You may want to reconsider thatI've got much more important things to do with my time.
The reason I asked you to watch is because I firmly believe 'your' very much more experienced and technically savvy than me so might see what am not seeing? And my turn to tell myself stop deviating from the subject at hand :-)
/which/ video am I supposed to be looking at: the 9:40 one?Yes please. Pay attention at 3:40 then again at 7:50 please and thank you. His code works as we can see in that video but when I try and type in the exact same code it chokes on me?
To emphasise my point from another thread: if you write to /sys/.../backlight you aren't talking to a device directly, ...Oh dear sorry I totally forgot. My lap-toppie under /sys/class/backlight has acpi_video0 and intel_backlight
Nearer home, if you look at my example code you'll see that there's some which goes out of its way to identify a (serial) device type: e.g. FTDI, WCH and so on (typically, so that it can find the instrument in which the chip is embedded). But that's not info that the device itself is exposing, rather it's the driver: /and/ there's a pseudofile which identifes the kernel module implementing the driver.Mark your code is impressive and a lot of thought has gone into it but it does not do the one thing I wouldl like it t show me how to do? Which is send a string from pascal to the arduino and have the nano recognise that string then do the needful.
Now, what video did you want me to watch, or (even better) can you tell me the problems you're having interpreting things? Because right now I think that you're stuff because you're not making a distinction between "file" as defined by Pascal, and "file" as defined by the kernel... which in the case of unix (and I say unix advisedly, since I'm including SunOS etc.) has additional calls to set Baud rate, DTR state and so on which you're blithely ignoring.I never ignored anything you sent 'blithely' or otherwise. I went through your code, was highly impressed at what you had done. Went through another couple of times looking for what I want to do and zilch. So saved your code for my own personal set of tools thinking this will come in handy someday.
Read my remark about portability: using the convenience functions is not portable.Will do @Thaddy thanks.
You may want to reconsider that after watching this (https://www.google.com/search?sca_esv=445c9ec50e6b4223&sca_upv=1&sxsrf=ADLYWIIYWGUSwNLjQ4IBXxRFqKR01qcp4A:1727093150707&q=pascal+arduino&tbm=vid&source=lnms&fbs=AEQNm0CRraR4AFMOJtZDUPiZk_hDDcI2gsUCGe9dZxqjUB5Fjbg9g5Dvlwra67P-0Tq9xG3V6wtiiRWn3AMd3MwHGOtFdRgA2KD1bARv7g8btBn6Jlpu6imrEpstW2EY-NoR5DuL98FVdmK9OH0IsUWSs3kBQGNjkiv0KxcLJR6RW4EGB5adX2SRbewUlFeAZEE3zLI2szaVLCj1-4TxmjOoB-MtUkPttA&sa=X&ved=2ahUKEwjmvPetg9mIAxWXFzQIHS7rHqIQ0pQJegQIEBAB&biw=1680&bih=863&dpr=1#fpstate=ive&vld=cid:a6037fa6,vid:UfQIkNl7gKM,st:0)Did you try the exact example mentioned in that video (but then with the USB port)?
Hello @rvk, yes I followed his steps to the letter. I am going to do it over again from scratch and will post a video so anyone interested can see.You may want to reconsider that after watching this (https://www.google.com/search?sca_esv=445c9ec50e6b4223&sca_upv=1&sxsrf=ADLYWIIYWGUSwNLjQ4IBXxRFqKR01qcp4A:1727093150707&q=pascal+arduino&tbm=vid&source=lnms&fbs=AEQNm0CRraR4AFMOJtZDUPiZk_hDDcI2gsUCGe9dZxqjUB5Fjbg9g5Dvlwra67P-0Tq9xG3V6wtiiRWn3AMd3MwHGOtFdRgA2KD1bARv7g8btBn6Jlpu6imrEpstW2EY-NoR5DuL98FVdmK9OH0IsUWSs3kBQGNjkiv0KxcLJR6RW4EGB5adX2SRbewUlFeAZEE3zLI2szaVLCj1-4TxmjOoB-MtUkPttA&sa=X&ved=2ahUKEwjmvPetg9mIAxWXFzQIHS7rHqIQ0pQJegQIEBAB&biw=1680&bih=863&dpr=1#fpstate=ive&vld=cid:a6037fa6,vid:UfQIkNl7gKM,st:0)Did you try the exact example mentioned in that video (but then with the USB port)?
You have TextFile and are sending complete strings while in that example just one letter is sent via a File of char.Yes I was trying to send 'more' than a single character like on/off. I have no idea how to keep a connection open :-( Thank you for the guidance.
Another possible problem... You close the /dev/ttyUSB0 port/file. This could reset things back. So you should not open and close it at the same place but keep a connection open. The downside of that could be that there could be done some buffering before flushing the data to that file/port so you might need to flush the data (or set the buffer to 0 or 1 before opening it as file).
Yes please. Pay attention at 3:40 then again at 7:50 please and thank you. His code works as we can see in that video but when I try and type in the exact same code it chokes on me?
It also makes lots of assumptions about the speed that the port is set to by default, the state of (in particular) DTR and so on.Connecting via usb would be standard and there would be no need for speed etc. But the arduino should also be programmed to receive it correctly.
It also makes lots of assumptions about the speed that the port is set to by default, the state of (in particular) DTR and so on.Connecting via usb would be standard and there would be no need for speed etc. But the arduino should also be programmed to receive it correctly.
@Aruna you also might want to show the other side (arduino code) because in the given video there is only character per character read (and not even from usb). And you might give some more information about how you connect both sides.Hi @rvk thank you for making me go over this again. I just found out what the problem is and your gonna have some serious fun with it when I disclose after I rustle up some grub because I am famished. Will be back in a bit. Your never going to believe what is happening with my nano :-)
So your pissed, so what else is new? Does not @Joanna upset and piss your off much more? ( What is a friend for ?) and flattery I save for the fairer sex like our Joanna. I called it the way I saw it. That code was something else, but not what I was looking for is all.Wow.. ok can anyone guess why I keep suggesting that people who don’t know pascal should not be allowed to post in the support part of these forums? >:D