Hi! Please forgive me if I’m not following proper protocol! I’m new, haven’t posted to any forum in many years, and my brain is fried from trying to figure things out on my own over the last few days. I’ve overcome several hurdles, but now I’m stuck! I prepared some information in Notepad++ which I’ve copied and pasted below with the triple backticks. This should explain my current hurdle better than I could in a normal set of sentences. I’m sorry if it’s too long or not formatted properly! I’m not use to any of this (Python, Chiplotle, etc.). Thanks so much! (I tried using colors to differentiate between my comments and what appeared on the screen, but they didn’t transfer. (Although, I later discovered I could creatively use single or double quotes to color my notes in red.) Therefore, I started each of my comments indented with “NOTE:” and ended each with “END NOTE”. Thanks again!)
"NOTE:
I am using Windows 11 and Windows PowerShell. (BTW,
I did not have any better luck using IDLE.)
END NOTE"
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
"NOTE:
I use the following line to set communication
parameters for the USB>Serial adapter I am using.
END NOTE"
PS C:\Users\dream> mode com7:9600,n,8,1,p
"NOTE:
Doing so returns the following information:
END NOTE"
Status for device COM7:
-----------------------
Baud: 9600
Parity: None
Data Bits: 8
Stop Bits: 1
Timeout: OFF
XON/XOFF: OFF
CTS handshaking: ON
DSR handshaking: ON
DSR sensitivity: OFF
DTR circuit: HANDSHAKE
RTS circuit: HANDSHAKE
"NOTE:
Here I run Chiplotle3.
END NOTE"
PS C:\Users\dream> chiplotle3
"NOTE:
Doing so returns the following information:
END NOTE"
+-----------------------+
| Chiplotle! v.0.4.1 |
+-----------------------+
Instantiated plotter HP7475A in port COM7:
Drawing limits: (left 0; bottom 0; right 11040; top 7721)
Buffer Size: 512
"NOTE:
If I enter each of the next two lines (after "chiplotle>")
one at a time, pressing 'Enter' after each line, the
plotter responds as expected.
END NOTE"
chiplotle> plotter.write(hpgl.PD([(500,500), (2500,4000),
(1000,2000), (500,500)]))
chiplotle> plotter.write(hpgl.PU([(100,100)]))
"NOTE:
I enter the following to exit out of Chiplotle:
END NOTE"
chiplotle> quit()
"NOTE:
I change directories to where I have a couple 'py' files and
run one called 'hello.py' by entering "python hello.py", which,
as expected, results in the two following lines of "Hello world".
END NOTE"
PS C:\Users\dream> cd C:\Users\dream\Documents\Python
PS C:\Users\dream\Documents\Python> python hello.py
Hello world
Hello world
"NOTE:
Next I try running a file to send some commands to the plotter.
Following is the code that is in the file Square.py. (I know
it is not a square, I am just trying to talk to the plotter.)
END NOTE"
"PROGRAM CODE
Line 01 from chiplotle3 import *
Line 02 plts = instantiate_plotters( )[0]
Line 03 plotter.write(hpgl.PU([(100,100)]))
Line 04 plotter.write(hpgl.PD([(500,500), (2500,4000),
(1000,2000), (500,500)]))
Line 05 plotter.select_pen(0)
END PROGRAM CODE"
PS C:\Users\dream\Documents\Python> python Square.py
Instantiated plotter HP7475A in port COM7:
Drawing limits: (left 0; bottom 0; right 11040; top 7721)
Buffer Size: 512
Traceback (most recent call last):
File "C:\Users\dream\Documents\Python\Square.py", line 3, in <module>
plotter[0].select_pen(2)
^^^^^^^
NameError: name 'plotter' is not defined. Did you mean: 'plotters'?
PS C:\Users\dream\Documents\Python>
"NOTE:
The first two lines of code function as expected, but at line 3, a
NameError results saying that plotter is not defined. I do not
understand why I am getting this error since I do not get it when I
enter and run that same line when at the chiplotle prompt. Does
anyone know what I am missing/not understanding, aka the solution?
Thanks!
END NOTE"