Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • stephen/sierpinski-plotter
1 result
Show changes
Commits on Source (2)
# sierpinski-plotter
Implementation of the Sierpinski Triangle [Chaos Game](https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle#Chaos_game). Instead of outputting to an image, it sends HP pen plotter commands to a serial port. Tested on the HP7440A, but probably works on others.
## Output
I think this is 12000 points or so? I let it run for a while, then I added the code to allow for watching progress, and then I let it run for like, 6-7k lines. It probably ran for 2-3 hours in total.
![][output.jpg]
output.jpg

2.05 MiB

......@@ -72,7 +72,9 @@ fn main() -> anyhow::Result<()> {
write!(&mut ser, "IN; SP 5; VS 40;")?;
let mut buf = [0];
for (x, y) in triangle.take(10_000) {
for (i, (x, y)) in triangle.enumerate() {
println!("{}", i);
// wait until our buffer is empty
write!(&mut ser, "OA;")?;
loop {
......