Jump to content

BITS1

Active Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by BITS1

  1. Hi DaberMania and everyone, Regarding SdFat library, is there a code that I can use to delete a file? The most recent SdFat library that I downloaded had the option of deleting a directory if only that it is empty. The old code: if ((!file.remove())) error("remove error"); didn't seem to work. I hope to hear from you guys soon! Thanks!
  2. Aww, that's too bad, I was really hoping that Teensy could do that without the user's help. Is it just the low level programming or how its made does not give it the ability to do that ? Sincerely, Bits1
  3. Hey littleguy1, What you had the teensy do was to type out each Drive name consecutively and once it found it, it remained in the same drive. I can suggest that you could redirect the command line back to drive C: each time you try to 'cd' to the new drive. If you do that, it will allow the script to run once when Teensy finds the correct drive. Hope it helps. Keep up the effort. :) Sincerely, Bits1
  4. Hello Everyone, From looking at everyone's posts, I noticed that the solution for Teensy to "recognize" which operating system it's in, is with the help of the dip switches. Teensy is programmed to rely on the user's dip switch combination to execute certain commands. I looked into the Arduino.app that has Teensyduino installed, in one of the pins_teensy.c file, it had if statements like: #if defined(__AVR_ATmega32U4__) ... #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) ... From my understanding, these conditional statements are to identify which version of Teensy it is right? If so, does anyone know how we can also identify the operating system that is running so that Teensy can identify it and execute certain commands? I am not great at programming so I hope you can shed light on this topic. Thank you very much. Bits1
  5. How do I see the Serial print output on the terminal instead of the Serial Port? Since the Teensy is in Keyboard and Sd Card mode, the serial device tty.usbmodem12341 or something like that does not show up...:( Bits1
  6. Hi Paul, This is uses the Mac Keyboard shortcuts to open the Spotlight, open up the textedit program, write Hello World! every 1 second while moving the mouse to a spontaneous place on the screen. Bits1 void setup(){ delay(2000); //opens spotlight Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_SPACE); Keyboard.send_now(); //release keys Keyboard.set_modifier(0); Keyboard.set_key1(0); Keyboard.send_now(); delay(200); //open textedit application Keyboard.print("Textedit"); Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); } void loop(){ delay(1000); //prints Hello World Keyboard.println("Hello World!"); //Moves mouse to random places Mouse.move(random(-127,127), random(-127,127)); }
  7. Hi guys, Here is my S3I library for Mac OS users. I have added some cool features (mischeviousMouse, inverting colors, keyboard shortcuts...etc) that you can have Teensy do! I hope that you guys can add more features to this library so everyone can use it too. Please tell me what you think. To use this library on your Arduino IDE, here's how: #include <S3I.h> S3I utility(11); The 11 is the LED pin number for Teensy 2.0 void setup(){ utility.openTerminal(); } void loop(){ do something } http://code.google.com/p/teensyprojects/downloads/list Sincerely, Bits1 (The S3I stands for SSSI meaning Search.Seize.Store Information)
  8. Hi Paul, I wrote you a message about the problem I have, can you please take a look at it? Thank you. Bits1
  9. Take a look at how you can write executable scripts. You can store those scripts to your sd card and have teensy execute them via command line! Once you have access to command line, you can do almost anything to that computer. :) Are you using a Mac OS or windows? Bits1
  10. Thank you for answering my question. I looked at the pjrc.com site and it stated "A 3.3 volt regulator and buffer chip allows using Micro SD cards with 5 volt systems. " I assume that the buffer chip is already SOLDERED on the SD card adapter? If it is true, then I suppose that will be alright? >.< Bits1
  11. Hi everyone, I have a question about the Teensy and the SDcard. Back in June, I have soldered the SDcard Adapter onto the Teensy WITHOUT the 3.3V regulator and it worked fine but then I found on the pjrc.com site that a 3.3v regulator can be used on the Teensy with the SDcard adapter to "protect the SDcard." My question is is the 3.3V regulator NECESSARY? In the long run, will the 5V damage the SDcard and the Teensy? Right now, the teensy has the SD card adapter and works fine so far. Thanks. Bits1
  12. Your code looks pretty good. I recommend that you create a library with the most commonly used commands so that you don't have to type the same thing over again. Have you looked at Irongeek's PHUKD library? It could save you some time and memory so that you can have Teensy do lots of other things. http://www.irongeek.com/i.php?page=securit...y_PHUKD_library It would be cool if you could also disable the firewall settings, or run some scripts that you have written for the Teensy. :) Good job on what you have so far! Bits1
  13. Whoops. Sorry, you are right. Thank you. Bits1
  14. Hi! You might want to try to code in Arduino Language, it's much simpler to use than C/ C++. Once you know what is going on, you can then move on to program in C++ since Arduino language is pretty much based on C/C++ :) Take a look at Irongeek's webpage on Teensy, he did a great job with the example codes he put up there. http://www.irongeek.com/i.php?page=securit...eystroke-dongle Hope it helps. Bits1
  15. Hi, I'm a beginner with programming in C/C++ as well. :) Here are some of the sites I found that are helpful to me in understanding C++ codes... I tried to define what the code says, so I hope it helps you somewhat :\ http://www.cppreference.com/wiki/preprocessor/define (C++ reference) http://msdn.microsoft.com/en-us/library/ty67wk28(VS.80).aspx http://www.cs.umd.edu/class/spring2003/cms...p/bitshift.html http://www.somacon.com/p125.php (bitwise operations) http://linux.die.net/man/3/uint16_t (Definition of terms used) http://www.pjrc.com/teensy/usb_keyboard.html (where you could find info about Teensy & codes) The #define is used to simplify your code. For example, if you have a certain method that you have to use again and again throughout your code and you don't want to spend all that time pasting the same code. Thus, the #define will tell the compiler that if this keyword is in the code, substitute it with this definition. Or, just Defining a variable to hold an expression or a value. Here's an example from a site I found: #define absolute_value(x) (((x)<0) ? (x) : (x) ) int num = -1; while ( absolute_value(num)){...} --Instead of having to write out the entire expression, I can just type in the keyword I defined earlier The conditional operator (?) returns one of two values depending on the value of a Boolean expression condition ? first_expression : second_expression; The PORTD |= (1<<6) |= is the binary bitwise inclusive Or, the << tells you that the bits are shifted to the left 6 times // Teensy 2.0: LED is active high //If its either Teensy 2.0 or Teensy ++ 2.0, then the LED light is defined by these definitions (PORTD ...) #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__) #define LED_ON (PORTD |= (1<<6)) #define LED_OFF (PORTD &= ~(1<<6)) // Teensy 1.0: LED is active low #else #define LED_ON (PORTD &= ~(1<<6)) #define LED_OFF (PORTD |= (1<<6)) #endif #define LED_CONFIG (DDRD |= (1<<6)) #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) #define DIT 80 /* unit time for morse code */ void morse_character(char c); void morse_P(const char *s); const unsigned char morse_code_table[]; int main(void) { unsigned char i; // set for 16 MHz clock, and make sure the LED is off CPU_PRESCALE(0); LED_CONFIG; //this was defined earlier too LED_OFF;[/code] //the LED_OFF was defined earlier, so compiler will fill in its value based on whether its Teensy 1.0 or Teensy 2.0
  16. Well, I found out that to read the files in SD card, I have to unmount the SD to allow the Serial to read the file. Well, does anyone know how a script could have some way to communicate with the Teensy's serial port? For example, if the Teensy executes a script on the computer, it writes something back to the sd card, Teensy unmounts the sd card and then reads the file. Does the Teensy have any type of flag that the computer could set when its finished running the script so that the teensy would know that the process is done? Thanks in advance. Bits1
  17. Hi, Have you made sure you connected the SD card adapter and the teensy with the correct pins? I have provided a picture of what I did with the Teensy and the SD card. I just soldered pins onto the Teensy and the SDAdapter and installed them onto the breadboard. And like Paul says, its probably the connection that was causing you problems. Also, the SDcard type also does somewhat affect the read and write ability too. I read that Sandisk and MicroDisk are good brands you could use. *Note: the red wires are for providing voltage and blue are grounding the Teensy and the Sdcard Adapter. I hope it helps. Bits1
  18. I got it to work! So I found out that I could read the sd card while I'm in the Keyboard and SD card mode. Previously I assumed that you MUST be in Serial mode in order to read the SD card but now it works anyway. :D Bits1
  19. Thank you Psychosis, it works pretty well. I was wondering, can Teensy switch from SD+Keyboard to Serial mode? In the beginning, I had teensy use keystrokes to run the script from the SD card but then I needed Teensy to switch to serial mode to read the resulting file in the sd card and blink continuously to indicate the file is in the SD card. It seems like if Teensy is in Serial mode, you cannot execute the script, only read and write...is this true? Thank you for answering my post. Bits1
  20. Hi guys I have a question, how do you create an autostart file to run on a mac? Like, I want to have the autostart file run the bash file when I plug Teensy into a computer. Then, once the bash file finishes, I can have Teensy, in Serial Mode, to read the result file that the bash file created...I don't know how to get Teensy, in serial mode, to execute a bash file so I thought maybe an autostart file would work? Please help me. I'm not sure how to go about doing this. I'm a beginner at this so any help is greatly appreciated. Bits1 I have some of SdFatRead code in my teensy project to check for the existance of a file: https://dl-web.dropbox.com/get/Public/mypro....zip?w=c052698a
  21. Hi! I am currently working with the Teensy and its SD card as well. You could get the Teensy to read files on the SD card and print its contents onto the Serial Monitor, the SDFatRead Example really helps when you try to see if that certain file exist, else you can change the mode and write instead...:) All this is done when the Teensy is in Serial Mode. Have you tried the SD card+keyboard? that one, you can get the keyboard to open up the command line and possibly execute a bash file and have the result file saved onto the SD card... How's your project doing? Bits1
  22. I just read from other posts about Teensy being a serial port... This is Paul's comment a few months ago... http://www.hak5.org/forums/index.php?showt...mp;#entry162691 When using USB Serial, which is the only way you can use normal Arduino boards, these can be used to build code which communicate with PC-based code. There's lots of code out there which communicates via serial ports, because for many years (since the 1980's even), using serial communication has been the main way to communicate with microcontrollers. So now I'm sure that it is possible to have microprocessors communicate back and forth with the PC or Mac. This would mean I have to post some type of interface between the teensy and the computer... Hm, Answers are everywhere, I guess I have to look harder. :) Bits1
  23. Can you also make teensy to be recognized as a usb wifi dongle or usb bluetooth dongle? I have seen some projects on your website that have incorporated teensy to work with bluetooth devices, joystick, in drum sets... I think they are great! :) I hope it helps. Bits1
×
×
  • Create New...