Author Topic: COMPETITION 2019 - Mini Thermal Printers  (Read 14621 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Folks, I'm so amazed about my new gadget. A thermal printer (see attached image).

I've got GLBasic code running, that can send a sprite image to that printer via bluetooth on your Android device. (You can use the BT library to talk to any bluetooth device, btw.)

For the competition you get a few functions in a library and this test project:
Code: (glbasic) [Select]
LOADSPRITE "Media/test.png", 101

LOCAL printer_pixels_width% = 384 // must be editable by user. Default = 384
DitherSprite(101, printer_pixels_width) // id%, cut_width%

// Show the dithered image - you can save or use that for debugging/preview
DRAWSPRITE 101,0,32
SHOWSCREEN


// List all paired BT devices - user must pick one from the list
LOCAL devs$[]
BT_ListDevices(devs$[])

// connect to one of the string in devs$[]
BT_connect("BlueTooth Printer")

// do print the image pixels
BT_print_image(101)

// close connection
BT_close()

// some more paper and cut (if device lets you do this)
BT_FeedPaperAndCut()

MOUSEWAIT

You will also get a function to pick a picture from camera or from the gallery.

The BlueTooth-Library attached is cross-platform and can talk to any BlueTooth device with raw data streams.



That's all you need. Now join the competition and write a software for that printer with the given functions. A demo project is attached. It might not compile for Android, but the function names wil stay as they are. I did tests and all is working great. Ready? Set? GO!

Do samething amazing. Something creative. Something funny. Something that makes one want to get such a printer.

The 1st prize is such a printer. Shiny new device, sparkling on your table, purring in your pocket.
2nd to 3rd price: Printer paper

Competition ends at March, 1st 2019.

PS.Spread the word - I'm not very connected in social media anymore  :good:

Edit - See my test project and the final libraries attached.

« Last Edit: 2019-Mar-28 by Kitty Hello »

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #1 on: 2018-Dec-09 »
This is great! I wanted to do thermal printer before using GLB.

So GLB 'can' print :)

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4176
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #2 on: 2018-Dec-09 »
Sounds cool :)
I came. I saw. I played.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2795
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #3 on: 2018-Dec-09 »
Aha, I had a similar device when I was a boy for my ZXSpectrum. It printed on shiny silver paper and made a lot of noise. It was great fun, though it made your fingers silver too from the weird paper it used.  :happy:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #4 on: 2018-Dec-10 »
Can the same be done to send from Desktop to printer via BT or USB?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4453
    • View Profile
    • FUED
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #5 on: 2018-Dec-18 »
I´m cracking my head on how to mix this all with a game. :good:

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #6 on: 2019-Jan-08 »
The code also works on Desktop now, yes.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #7 on: 2019-Jan-10 »
WTF! really niiiice!
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #8 on: 2019-Jan-10 »
The code also works on Desktop now, yes.

Hi _ I downloaded the sample but it says Android_javacall function not found...I am missing something?
Also - for desktop - windows - surely javacall is not used?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #9 on: 2019-Jan-12 »
I'll soon update the code. It will compile on V16 (lots of compiler imporvements were required)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #10 on: 2019-Jan-30 »
I'll soon update the code. It will compile on V16 (lots of compiler imporvements were required)
Hi
On v16 compiling the Thermal printer code
"BluetoothAndroid.gbas"(67) error : GPC0006 wrong number of aguments : "android_JAVACALL" called with 2 args. Required: 0 to 1

(also tiny misspelling - aguments)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Will be possible get data from the devices?¿.... With Bluetooh HC-05 and arduino works.
« Last Edit: 2019-Jun-03 by mentalthink »

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 389
  • to program what I have do how should programming?
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #12 on: 2020-Feb-29 »
 can not open bluetooth.zip. CRC error.
Could you verify?
Thank you

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #13 on: 2020-Feb-29 »
Yes, it's damaged but I think you can find the file in your samples folder (GLBasic\Samples\_Projects_\Bluetooth.zip)

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 389
  • to program what I have do how should programming?
    • View Profile
Re: COMPETITION 2019 - Mini Thermal Printers
« Reply #14 on: 2020-Feb-29 »
Perfect.
Thank you