Scripting Baudot 5-bit generation
in
Programming Questions
•
11 months ago
Hi All,
I'm currently trying to make a script that when you type in
plaintext, you get the Baudot 5-bit generation of it, like the old punched tape that was used.
The overall idea is to then, plug this into grasshopper for Rhino so that it can modify geometry.
I'm very new to processing and scripting so I haven't got far at all, not sure what the best way to do this is even.
My script so far only generates some ellipses when you press "A" (incorrect Baudot code for A - these are just markers for where the holes could be for all letters):
void setup(){
size (1000,600);
background (255);
}
size (1000,600);
background (255);
}
float x = 20;
float y = 100;
float y = 100;
void draw() {
if (keyPressed){
if (key == 'a' || key == 'A') {
ellipse (x,y+20,18,18);
ellipse (x,y+45,18,18);
ellipse (x,y+70,12,12);
ellipse (x,y+95,18,18);
ellipse (x,y+120,18,18);
ellipse (x,y+145,18,18);
}
fill(0);
noStroke();
}
}
I guess my questions are:
- I have to script the outcome for each letter in the same way? Or is there another way to treat it as a line of text?
- How do I get the x/y values of the holes to change each time a letter is pressed. ie with that code, if you press 'A' again, it will appear to the right of the 1st set of ellipses...
- ...or can I treat the dots as lines of text, so when it exceeds the width of the void setup, it drops to another line and you can still see it being punched in.
- I understand there can only be one
setup? Is there any way to see the plaintext as it is being typed as Baudot as well?
- Is it possible to plug this in to grasshopper via gHowl or do I have to do it another way? Am i wasting my time??
I hope that makes sense,
thanks in advance :)
1