Author Topic: IRC - dot matrix printer  (Read 14526 times)

0 Members and 4 Guests are viewing this topic.

Offline williefleeteTopic starter

  • Regular Contributor
  • *
  • Posts: 109
  • Country: nz
Re: IRC - dot matrix printer
« Reply #25 on: July 28, 2015, 04:51:44 am »
it will take about 16mS per character maybe 18mS for the additional strobe for the printer (~2mS per clock pulse period) that is running the PICAXE 08m at 8Mhz
Oh, I didn't realise PICAXEs were so inefficient.


That's for converting an 8bit number to shift register clock and data, the display I made using an 08m takes about 256mS to update 64 LEDs (has to update 2 registers per LED display, the address shift reg and a display shift reg, large changes appear as a wave/slow scan) and it needs at least 350+mS between 8byte bursts of data
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: IRC - dot matrix printer
« Reply #26 on: July 28, 2015, 04:53:53 am »
I'm pretty sure you could find information for creating an IRC bot and modifying it to send what is going on the channel to the printer.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: IRC - dot matrix printer
« Reply #27 on: July 28, 2015, 07:20:03 am »
I doubt it, because telnet is not scriptable.  You would need to script it, so you can detect errors properly and extract the meaningful parts of the server output.

Python is still a good choice , even on Windows (because it's available and works).

For the geekgroup, you need to first use a regular IRC client to register a nickname and password with the IRC server
Then you can connect to the server (irc.thegeekgroup.org port 6667)

send \r\n
  ( you'll get an IDENT check here )
send PASS <password> \r\n
send NICK <nickname> \r\n
send USER <nickname> 8 * :dot-matrix-printer \r\n
send JOIN :#thegeekgroup \r\n
   (you'll get the channel topic and a list of users back in reply )

after you've joined, you'll start to receive a rolling list of messages from the server. This will include JOIN, QUIT, MODE, etc... from all other users, as well as channel text. You are only interested in PRIVMSG from other users to the #channel, as this will be the public channel text.

for example, in #freenode channel:

$ telnet chat.freenode.net 6667
Trying 130.239.18.119...
Connected to chat.freenode.net.
Escape character is '^]'.
:leguin.freenode.net NOTICE * :*** Looking up your hostname...
:leguin.freenode.net NOTICE * :*** Checking Ident
:leguin.freenode.net NOTICE * :*** Found your hostname
:leguin.freenode.net NOTICE * :*** No Ident response
NICK foobar6666
USER foobar6666 8 * :test user
:leguin.freenode.net 001 foobar6666 :Welcome to the freenode Internet Relay Chat Network foobar6666
[... lots of MOTD stuff here removed ]
:leguin.freenode.net 376 foobar6666 :End of /MOTD command.
:foobar6666 MODE foobar6666 :+i
JOIN :#freenode
[ user list is here, I removed it ]
:[email protected] PRIVMSG #freenode :no, I misworded it. I'm sure you /do/ have the potential to handle it properly, and I ask you to unleash that potential, but if you are lazy then just ignoring them is the next best option
:[email protected] JOIN #freenode
:Tony99-!uid40440@gateway/web/irccloud.com/x-ukdywdylqparggxo QUIT :Quit: Connection closed for inactivity
:[email protected] QUIT :Quit: Have a nice day! :D
:CooloutAC!CooloutAC@gateway/shell/panicbnc/x-ypoibjgelivdqkzg PRIVMSG #freenode :lol
:sayan!~sayan@fedora/sayan QUIT :Ping timeout: 244 seconds
:CooloutAC!CooloutAC@gateway/shell/panicbnc/x-ypoibjgelivdqkzg PRIVMSG #freenode :i don't have ignore in my blood


You start to receive lots of PRIVMSG, JOIN and QUIT messages above. The PRIVMSG #channel is the part you care about, where you can extract the author, the message, and you need to add you're own timestamp. Then print that to the printer log.

If you look at the above you will realize it's not a simple matter of just using telnet.

You can take each line above in a python script and make something useful from it. For example, you can also choose to log channel joins and quits, as well as the channel text if you want to.
 

Offline daveatol

  • Regular Contributor
  • *
  • Posts: 136
  • Country: au
Re: IRC - dot matrix printer
« Reply #28 on: July 28, 2015, 07:39:19 am »
Perhaps you could script it something like this:?
Code: [Select]
( echo open ${host} ${port}
  sleep 5
  echo -n -e "\r\n"
  sleep 3
  echo -n -e "PASS ${pass}\r\n"
  sleep 3
  echo -n -e "NICK ${nick}\r\n"
  sleep 3
  echo -n -e "USER ${user}\r\n"
  sleep 3
  echo -n -e "JOIN :#thegeekgroup\r\n") | telnet | grep PRIVMSG | sed -r "s/^:([^!]*)[^:]*:(.*)$/\1 said: \2\r\n/" | ./sp_convert.sh > /dev/ttyS0
 

Offline williefleeteTopic starter

  • Regular Contributor
  • *
  • Posts: 109
  • Country: nz
Re: IRC - dot matrix printer
« Reply #29 on: July 28, 2015, 09:34:13 am »
[snip]

 
Perhaps you could script it something like this:?
Code: [Select]
( echo open ${host} ${port}
  sleep 5
  echo -n -e "\r\n"
  sleep 3
  echo -n -e "PASS ${pass}\r\n"
  sleep 3
  echo -n -e "NICK ${nick}\r\n"
  sleep 3
  echo -n -e "USER ${user}\r\n"
  sleep 3
  echo -n -e "JOIN :#thegeekgroup\r\n") | telnet | grep PRIVMSG | sed -r "s/^:([^!]*)[^:]*:(.*)$/\1 said: \2\r\n/" | ./sp_convert.sh > /dev/ttyS0

Thanks for the info, if I can play around with it on some of the old motherboards I have, I will give it a go. If I could afford a rPi I could try that I guess.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: IRC - dot matrix printer
« Reply #30 on: July 28, 2015, 04:41:58 pm »
Perhaps you could script it something like this:?

Yeah, that's a good way to use existing tools and the shell to script it. I like your answer :)

It would work as a most basic telnet receiver.  It's going to work 99% of the time, probably. 
For error checking, you could use expect(1) scripts then, and that would allow you to script the telnet communication to do something useful on failure.

However once you get into scripting it (with expect), you might discover that it becomes more of a hack, and wish you started with Python in the first place :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->