Home

Sunday, January 30, 2005

PIC > PIC

This section will cover all my PIC microcontroller projects. For those of you who dont know what a microcontroller is, its a little chip that you can program to do stuff. They're used in almost everything electrical. The PIC microcontroller is developed by Microchip. The first PIC I'm using is the PIC18F452. It's an 8 bit MCU with 32kB of flash memory, and 32 pins of I/O, 2 Timers, 2 A/D converters, and a watchdog timer. I'll explain what all of this means in the sections to follow.

Code > Winamp Update

Heres the latest winamp name parsing code:

  1. global $title; 
  2. $title=eregi_replace(" ", " - ", $title); 
  3. $info=explode(" - ", $title); 
  4. $last=count($info)-1; 
  5. $title=$info[$last]; 
  6. $artist=$info[0]; 
  7. for($b=1;$b<(count($info)-1);$b++){ 
  8. if(!eregi("([0-9]{2})", $info[$b])){ 
  9. $artist .= " - $info[$b]"; 
  10. } else { 
  11. $track=$info[$b]; 
  12. $artist=explode(" - ", $artist); 
  13. $last=count($artist)-1; 
  14. $artist=$artist[$last]; 
  15. if($info[1] == $artist){ 
  16. $artist = "$info[0] -$artist"; 
  17.  
  18.  
  19.  
  20. $sql="select * from winamp order by date DESC, time DESC limit 0,1"; 
  21. $result = mysql_query($sql); 
  22. $row=mysql_fetch_array($result); 
  23. $time=strtotime($row[time]); 
  24. $now=time(); 
  25. $today=date("Y-m-d"); 
  26. if ((($now - $time) < 30) || ($today != $row[date])){ 
  27.  
  28. $sql="delete from winamp where id=$row[id]"; 
  29. mysql_query($sql); 
  30.  
  31. $sql="update songs set count=count-1 where id=$row[title] and artistid=$row[artist]"; 
  32. mysql_query($sql); 
  33. $sql="update artists set count=count-1 where id=$row[artist]"; 
  34. mysql_query($sql); 
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. $sql="select * from artists where name='$artist'"; 
  42. $result=mysql_query($sql); 
  43. $artinfo=mysql_fetch_array($result); 
  44. $artcount=mysql_num_rows($result); 
  45.  
  46. $sql="select * from songs where name='$title' and artistid=$artinfo[id]"; 
  47. echo $sql."<br>"; 
  48. $result=mysql_query($sql); 
  49. $songinfo=mysql_fetch_array($result); 
  50. $songcount=mysql_num_rows($result); 
  51.  
  52. if($artcount > 0){ 
  53. $artistid=$artinfo[id]; 
  54. $artcounter=$artinfo[count]+1; 
  55. $sql="update artists set count=$artcounter where id=$artinfo[id]"; 
  56. mysql_query($sql); 
  57. } else { 
  58. $sql="insert into artists(name, count) values ('$artist', '1')"; 
  59. mysql_query($sql); 
  60. $sql="select * from artists where name='$artist'"; 
  61. $result=mysql_query($sql); 
  62. $artinfo=mysql_fetch_array($result); 
  63. $artistid=$artinfo[id]; 
  64. echo "song count $songcount"; 
  65. if($songcount > 0){ 
  66. $songid=$songinfo[id]; 
  67. $songcounter=$songinfo[count]+1; 
  68. $sql="update songs set count=$songcounter where id=$songinfo[id] and artistid=$artinfo[id]"; 
  69. mysql_query($sql); 
  70. } else { 
  71. $sql="insert into songs(name, count, artistid) values ('$title', '1', '$artinfo[id]')"; 
  72. mysql_query($sql); 
  73. $sql="select * from songs where name='$title' and artistid=$artinfo[id]"; 
  74. $result=mysql_query($sql); 
  75. $songinfo=mysql_fetch_array($result); 
  76. $songid=$songinfo[id]; 
  77.  
  78. echo "Curr album: $curralbum:"; 
  79. mysql_query("insert into winamp(artist, title, date, time, track, songlength) values('$artistid', '$songid', now(), now(), '$track', '$length')"); 

Monday, January 24, 2005

Links > Numanuma

Wierd clip of a guy dancing/lip syncing a song
Click Me

The song is actually by a Romanian group called O-Zone. The song is called Dragostea Din Tei. It's actually not bad. Good beat. anyway, here are the lyrics in Romanian and English.

Main > 4:14 PM

Hi all. Been busy for a while. My sleeping is finally back to normal. My sister moved out to her own house on 9th, my friend Daniel used to live there. I made my closet into an electronics bench, works well, needs to be organized though, I'll add pictures eventually in another post. I've been experimenting with PIC chips, specifically the PIC18F452. I'll make a post about that later in the projects section. I've been learning some basic electronics theory, like class A amplifier designs, stuff like that. If anyone knows any good websites for that kind of stuff, lemme know. Well, I'm getting bored with this typing stuff, so I'll add another post later to finish it off. Bye.

Saturday, January 15, 2005

Stepper Motor Control > Finished

Well, it works. I shouldve hooked it up better do i could make it run decently. but my goal of getting it working was accomplished. Here's some pics:


The IC attached to the motor. This didn't work out as the wires became detached. So I rebuilt it.


Yay. Done.


Close Up


Close Up of the back.


Badly drawn Schematic Layout.


Well, thats it for this part of this project. Later I will be building a proper controller and making either a plotter or CNC router.

Stepper Motor Control > Stepper Motor Control

Well, I've decided to try to make a stepper motor control assembly from a floppy drive. so far i unsoldered the controller chip, and the motor itself.
Thats all I have so far. I have the data sheet, so now im going to solder the motor on, and try to see what else i can get done.

Sunday, January 09, 2005

Main > Music Stats

Wow, I havent posted here in a loooong time. Bout time I did. Well, as for life, not much is new. Other than modding Xbox's, I haven't been up to anything. That, and coding. In fact, if you look to your right, and look under "Currently Playing", you'll see a new link to Music Stats. I got the idea from Crystal, who has a similar feature using Audio Scrobbler. It basically tracks the songs you play and gives you a nice little stats page. I figured I could do it as well with my own code. And I did. Ill post code later. We'll, thats all for now.

Friday, December 31, 2004

T-Line > Stage 1 Done.

Ok, heres how it all went. I got the tube from Daniel, who got it from I don't know where. Next I took a piece of plywood, cut it in a ring, bolted it to the tube, bolted the sub to the tube, attached it to a 450W RMS H/K amp, and were done. Ill make a better write up with detailed instructions and pictures later.

Main > Big Update

Sorry I haven't been posting. I've been busy. Anyway, the news. I got my 12" Alpine sub. It pounds. I love it. lol. running at 450W RMS, it shakes everything. It needs a better tube though, as the alpine flexes the crap outta this one. It's so bad I had to strap it to the wall for now. I'll post pics later. My soldering iron broke. and while tryiong to fix it, I pinched my middle finger on my left hand in the plier, an I have a harsh blood blister now. I also modded Kyle's XBOX. Fairly easy install, getting the solder out of the holes on the lpc debug port was a pain though. Other than that, it was easy. The software's gonne be a pain though. Lance gets his modchip soon, so I'll post pics of both. Thats about all for now. Bye.

Monday, December 27, 2004

Main > Custom

I've added the ability to minimize and maximize the sidebar items. Your prefs are stored in a cookie so they don't reset every visit. Unfortunatly, if i rearrange the blocks, or add more, the prefs get screwed up, as the prefs are sort number based. so when you hit minimize on the 3rd item, if the 3rd item changes, the new 3rd item will be minimized. Not a big deal as I don't plan on changing the sidebar much. I might somehow tie it to the name of the block, in fact, i just thought of how i could do it, and I will right now.


Update. Well, that was fast. As opposed to autoassigning a number, I just hard coded a number in. $num=1; etc.
Select a Page
Page 5 of 11 Pages < 1 2 3 4 5 6 7 8 9 10 11 >